Update workflow statuses in real time (#11653)
Statuses are maintained by an async job. Those are calculations that we would like to avoid using in both frontend and backend. Using push updates are an easier way. https://github.com/user-attachments/assets/31e44a82-08a8-4100-a38e-c965d5c73ee8
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import { useApolloClient } from '@apollo/client';
|
||||
import { useOnDbEvent } from '@/subscription/hooks/useOnDbEvent';
|
||||
import { DatabaseEventAction } from '~/generated/graphql';
|
||||
import { useApolloClient } from '@apollo/client';
|
||||
import { capitalize, isDefined } from 'twenty-shared/utils';
|
||||
import { DatabaseEventAction } from '~/generated/graphql';
|
||||
|
||||
type ListenRecordUpdatesEffectProps = {
|
||||
objectNameSingular: string;
|
||||
@ -39,6 +39,7 @@ export const ListenRecordUpdatesEffect = ({
|
||||
fields: fieldsUpdater,
|
||||
});
|
||||
},
|
||||
skip: listenedFields.length === 0,
|
||||
});
|
||||
|
||||
return null;
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||
|
||||
export const getDefaultRecordFieldsToListen = ({
|
||||
objectNameSingular,
|
||||
}: {
|
||||
objectNameSingular: string;
|
||||
}) => {
|
||||
switch (objectNameSingular) {
|
||||
case CoreObjectNameSingular.Workflow:
|
||||
return ['statuses'];
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user