The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Fix refetch on workflow status update (#9946)
Thomas Trompette4e32fd1c98ae
diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/hooks/__tests__/useDeactivateWorkflowSingleRecordAction.test.ts b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/hooks/__tests__/useDeactivateWorkflowSingleRecordAction.test.tsindex 77bc31ff810..4faa84f1206 100644--- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/hooks/__tests__/useDeactivateWorkflowSingleRecordAction.test.ts+++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/hooks/__tests__/useDeactivateWorkflowSingleRecordAction.test.ts@@ -142,8 +142,9 @@ describe('useDeactivateWorkflowSingleRecordAction', () => {result.current.onClick();});- expect(deactivateWorkflowVersionMock).toHaveBeenCalledWith(- activeWorkflowMock.currentVersion.id,- );+ expect(deactivateWorkflowVersionMock).toHaveBeenCalledWith({+ workflowVersionId: activeWorkflowMock.currentVersion.id,+ workflowId: activeWorkflowMock.id,+ });});});diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/hooks/__tests__/useDiscardDraftWorkflowSingleRecordAction.test.ts b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/hooks/__tests__/useDiscardDraftWorkflowSingleRecordAction.test.tsindex 430954ddd93..4157e5f8a17 100644--- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/hooks/__tests__/useDiscardDraftWorkflowSingleRecordAction.test.ts+++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/hooks/__tests__/useDiscardDraftWorkflowSingleRecordAction.test.ts@@ -216,7 +216,7 @@ describe('useDiscardDraftWorkflowSingleRecordAction', () => {expect(result.current.shouldBeRegistered).toBe(true);});- it('should call deactivateWorkflowVersion on click', () => {+ it('should call deleteOneWorkflowVersion on click', () => {(useWorkflowWithCurrentVersion as jest.Mock).mockImplementation(() => draftWorkflowMock,);diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/hooks/useDeactivateWorkflowSingleRecordAction.ts b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/hooks/useDeactivateWorkflowSingleRecordAction.tsindex 2a51f735b8f..873993ee476 100644--- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/hooks/useDeactivateWorkflowSingleRecordAction.ts+++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/hooks/useDeactivateWorkflowSingleRecordAction.ts@@ -21,7 +21,10 @@ export const useDeactivateWorkflowSingleRecordAction: ActionHookWithoutObjectMetreturn;}- deactivateWorkflowVersion(workflowWithCurrentVersion.currentVersion.id);+ deactivateWorkflowVersion({+ workflowVersionId: workflowWithCurrentVersion.currentVersion.id,+ workflowId: workflowWithCurrentVersion.id,+ });};return {diff --git a/packages/twenty-front/src/modules/workflow/components/RecordShowPageWorkflowHeader.tsx b/packages/twenty-front/src/modules/workflow/components/RecordShowPageWorkflowHeader.tsxindex 7c576ce512a..0127d7b7206 100644--- a/packages/twenty-front/src/modules/workflow/components/RecordShowPageWorkflowHeader.tsx+++ b/packages/twenty-front/src/modules/workflow/components/RecordShowPageWorkflowHeader.tsx@@ -122,9 +122,10 @@ export const RecordShowPageWorkflowHeader = ({workflowWithCurrentVersion,);- return deactivateWorkflowVersion(- workflowWithCurrentVersion.currentVersion.id,- );+ return deactivateWorkflowVersion({+ workflowVersionId: workflowWithCurrentVersion.currentVersion.id,+ workflowId: workflowWithCurrentVersion.id,+ });}}/>) : null}diff --git a/packages/twenty-front/src/modules/workflow/components/RecordShowPageWorkflowVersionHeader.tsx b/packages/twenty-front/src/modules/workflow/components/RecordShowPageWorkflowVersionHeader.tsxindex e0506ef8d10..95ef0c28ccd 100644--- a/packages/twenty-front/src/modules/workflow/components/RecordShowPageWorkflowVersionHeader.tsx+++ b/packages/twenty-front/src/modules/workflow/components/RecordShowPageWorkflowVersionHeader.tsx@@ -130,7 +130,10 @@ export const RecordShowPageWorkflowVersionHeader = ({Icon={IconPlayerStop}disabled={isWaitingForWorkflowVersion}onClick={() => {- return deactivateWorkflowVersion(workflowVersion.id);+ return deactivateWorkflowVersion({+ workflowVersionId: workflowVersion.id,+ workflowId: workflowVersion.workflowId,+ });}}/>) : null}diff --git a/packages/twenty-front/src/modules/workflow/hooks/useActivateWorkflowVersion.ts b/packages/twenty-front/src/modules/workflow/hooks/useActivateWorkflowVersion.tsindex efde1e698b7..70bca3a7c8f 100644--- a/packages/twenty-front/src/modules/workflow/hooks/useActivateWorkflowVersion.ts+++ b/packages/twenty-front/src/modules/workflow/hooks/useActivateWorkflowVersion.ts@@ -37,7 +37,7 @@ export const useActivateWorkflowVersion = () => {{query: findManyWorkflowVersionsQuery,variables: {- id: workflowId,+ workflowId,},},],diff --git a/packages/twenty-front/src/modules/workflow/hooks/useDeactivateWorkflowVersion.ts b/packages/twenty-front/src/modules/workflow/hooks/useDeactivateWorkflowVersion.tsindex 4eaddb750b4..41957884941 100644--- a/packages/twenty-front/src/modules/workflow/hooks/useDeactivateWorkflowVersion.ts+++ b/packages/twenty-front/src/modules/workflow/hooks/useDeactivateWorkflowVersion.ts@@ -22,7 +22,13 @@ export const useDeactivateWorkflowVersion = () => {objectNameSingular: CoreObjectNameSingular.WorkflowVersion,});- const deactivateWorkflowVersion = async (workflowVersionId: string) => {+ const deactivateWorkflowVersion = async ({+ workflowVersionId,+ workflowId,+ }: {+ workflowVersionId: string;+ workflowId: string;+ }) => {await mutate({variables: {workflowVersionId,@@ -31,7 +37,7 @@ export const useDeactivateWorkflowVersion = () => {{query: findManyWorkflowVersionsQuery,variables: {- id: workflowVersionId,+ workflowId,},},],