Improved table flash on reload (#16419)
This PR fixes https://github.com/twentyhq/core-team-issues/issues/1732 There is still some room for improvement but the main goal is reached : removing the flash effect each time the table virtualization has to recompute due to an update after initial loading. # QA ## Create https://github.com/user-attachments/assets/1b4fc307-42ce-4ba6-b557-68ac7fcad40f ## Update with sort https://github.com/user-attachments/assets/e0700f44-8926-4395-8ab8-b32773f21de8 ## Update with filter https://github.com/user-attachments/assets/d325f85a-1a7b-4366-aac3-250331be7575 ## Soft delete https://github.com/user-attachments/assets/2c980183-c637-4aa7-a0ca-244e61396b20 ## Restore and destroy https://github.com/user-attachments/assets/01af9ec7-b442-4686-a1d7-ea1fc543fe62 ## Drag & drop https://github.com/user-attachments/assets/bba76bdb-d4ec-433d-b44e-37fdb9952b06 --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';
|
||||
import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
|
||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||
import { useRegisterObjectOperation } from '@/object-record/hooks/useRegisterObjectOperation';
|
||||
import { useStopWorkflowRunMutation } from '~/generated-metadata/graphql';
|
||||
|
||||
@@ -9,17 +11,20 @@ export const useStopWorkflowRun = () => {
|
||||
});
|
||||
const { registerObjectOperation } = useRegisterObjectOperation();
|
||||
|
||||
const { objectMetadataItem } = useObjectMetadataItem({
|
||||
objectNameSingular: CoreObjectNameSingular.WorkflowRun,
|
||||
});
|
||||
|
||||
const stopWorkflowRun = async (workflowRunId: string) => {
|
||||
const { data } = await mutate({
|
||||
await mutate({
|
||||
variables: {
|
||||
workflowRunId,
|
||||
},
|
||||
});
|
||||
|
||||
registerObjectOperation('workflowRun', {
|
||||
registerObjectOperation(objectMetadataItem, {
|
||||
type: 'update-one',
|
||||
result: {
|
||||
updatedRecord: data?.stopWorkflowRun,
|
||||
updateInput: { id: workflowRunId },
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user