Only fetch steps and trigger for the current workflow version (#15003)
Avoid fetching full steps and trigger for versions that are not the current version. Because those won't be used anyway. Better for performances. Only difficulty was for the `createDraft` mutation. I needed to return the full created version so I can store it in cache and use it as new `currentVersion`. Otherwise the current version is considered as incomplete for a short time, since workflow is fetched separately from the current version. --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
import { useEffect } from 'react';
|
||||
import { type Decorator } from '@storybook/react';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
import { useUpsertRecordsInStore } from '@/object-record/record-store/hooks/useUpsertRecordsInStore';
|
||||
|
||||
export const RecordStoreDecorator: Decorator = (Story, context) => {
|
||||
const { records } = context.parameters;
|
||||
|
||||
const { upsertRecords } = useUpsertRecordsInStore();
|
||||
const { upsertRecordsInStore } = useUpsertRecordsInStore();
|
||||
|
||||
useEffect(() => {
|
||||
upsertRecords(records);
|
||||
upsertRecordsInStore(records);
|
||||
});
|
||||
|
||||
return <Story />;
|
||||
|
||||
@@ -10,10 +10,10 @@ export const JestRecordStoreSetter = ({
|
||||
children: ReactNode;
|
||||
records: ObjectRecord[];
|
||||
}) => {
|
||||
const { upsertRecords } = useUpsertRecordsInStore();
|
||||
const { upsertRecordsInStore } = useUpsertRecordsInStore();
|
||||
|
||||
useEffect(() => {
|
||||
upsertRecords(records);
|
||||
upsertRecordsInStore(records);
|
||||
});
|
||||
|
||||
return <>{children}</>;
|
||||
|
||||
Reference in New Issue
Block a user