Fix refetch on workflow status update (#9946)
Refetch was not set-up properly on activation/deactivation
This commit is contained in:
@ -142,8 +142,9 @@ describe('useDeactivateWorkflowSingleRecordAction', () => {
|
|||||||
result.current.onClick();
|
result.current.onClick();
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(deactivateWorkflowVersionMock).toHaveBeenCalledWith(
|
expect(deactivateWorkflowVersionMock).toHaveBeenCalledWith({
|
||||||
activeWorkflowMock.currentVersion.id,
|
workflowVersionId: activeWorkflowMock.currentVersion.id,
|
||||||
);
|
workflowId: activeWorkflowMock.id,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -216,7 +216,7 @@ describe('useDiscardDraftWorkflowSingleRecordAction', () => {
|
|||||||
expect(result.current.shouldBeRegistered).toBe(true);
|
expect(result.current.shouldBeRegistered).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should call deactivateWorkflowVersion on click', () => {
|
it('should call deleteOneWorkflowVersion on click', () => {
|
||||||
(useWorkflowWithCurrentVersion as jest.Mock).mockImplementation(
|
(useWorkflowWithCurrentVersion as jest.Mock).mockImplementation(
|
||||||
() => draftWorkflowMock,
|
() => draftWorkflowMock,
|
||||||
);
|
);
|
||||||
|
|||||||
@ -21,7 +21,10 @@ export const useDeactivateWorkflowSingleRecordAction: ActionHookWithoutObjectMet
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
deactivateWorkflowVersion(workflowWithCurrentVersion.currentVersion.id);
|
deactivateWorkflowVersion({
|
||||||
|
workflowVersionId: workflowWithCurrentVersion.currentVersion.id,
|
||||||
|
workflowId: workflowWithCurrentVersion.id,
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -122,9 +122,10 @@ export const RecordShowPageWorkflowHeader = ({
|
|||||||
workflowWithCurrentVersion,
|
workflowWithCurrentVersion,
|
||||||
);
|
);
|
||||||
|
|
||||||
return deactivateWorkflowVersion(
|
return deactivateWorkflowVersion({
|
||||||
workflowWithCurrentVersion.currentVersion.id,
|
workflowVersionId: workflowWithCurrentVersion.currentVersion.id,
|
||||||
);
|
workflowId: workflowWithCurrentVersion.id,
|
||||||
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
|
|||||||
@ -130,7 +130,10 @@ export const RecordShowPageWorkflowVersionHeader = ({
|
|||||||
Icon={IconPlayerStop}
|
Icon={IconPlayerStop}
|
||||||
disabled={isWaitingForWorkflowVersion}
|
disabled={isWaitingForWorkflowVersion}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
return deactivateWorkflowVersion(workflowVersion.id);
|
return deactivateWorkflowVersion({
|
||||||
|
workflowVersionId: workflowVersion.id,
|
||||||
|
workflowId: workflowVersion.workflowId,
|
||||||
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
|
|||||||
@ -37,7 +37,7 @@ export const useActivateWorkflowVersion = () => {
|
|||||||
{
|
{
|
||||||
query: findManyWorkflowVersionsQuery,
|
query: findManyWorkflowVersionsQuery,
|
||||||
variables: {
|
variables: {
|
||||||
id: workflowId,
|
workflowId,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@ -22,7 +22,13 @@ export const useDeactivateWorkflowVersion = () => {
|
|||||||
objectNameSingular: CoreObjectNameSingular.WorkflowVersion,
|
objectNameSingular: CoreObjectNameSingular.WorkflowVersion,
|
||||||
});
|
});
|
||||||
|
|
||||||
const deactivateWorkflowVersion = async (workflowVersionId: string) => {
|
const deactivateWorkflowVersion = async ({
|
||||||
|
workflowVersionId,
|
||||||
|
workflowId,
|
||||||
|
}: {
|
||||||
|
workflowVersionId: string;
|
||||||
|
workflowId: string;
|
||||||
|
}) => {
|
||||||
await mutate({
|
await mutate({
|
||||||
variables: {
|
variables: {
|
||||||
workflowVersionId,
|
workflowVersionId,
|
||||||
@ -31,7 +37,7 @@ export const useDeactivateWorkflowVersion = () => {
|
|||||||
{
|
{
|
||||||
query: findManyWorkflowVersionsQuery,
|
query: findManyWorkflowVersionsQuery,
|
||||||
variables: {
|
variables: {
|
||||||
id: workflowVersionId,
|
workflowId,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user