Prevent workflow right drawer flickering when selecting an action type (#8028)
In this PR: - Use a stable id for create-step nodes; it makes it possible to preserve their selected attribute and keep them open even after the flow is re-generated - Preemptively open the WorkflowStepEdit right drawer for the created action https://github.com/user-attachments/assets/c19e6820-e198-4d06-98ae-898bd6e53e33 Fixes https://github.com/twentyhq/private-issues/issues/123
This commit is contained in:
committed by
GitHub
parent
315820ec86
commit
e44d525e83
@ -1,8 +1,11 @@
|
||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||
import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord';
|
||||
import { useRightDrawer } from '@/ui/layout/right-drawer/hooks/useRightDrawer';
|
||||
import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
|
||||
import { useCreateNewWorkflowVersion } from '@/workflow/hooks/useCreateNewWorkflowVersion';
|
||||
import { workflowCreateStepFromParentStepIdState } from '@/workflow/states/workflowCreateStepFromParentStepIdState';
|
||||
import { workflowDiagramTriggerNodeSelectionState } from '@/workflow/states/workflowDiagramTriggerNodeSelectionState';
|
||||
import { workflowSelectedNodeState } from '@/workflow/states/workflowSelectedNodeState';
|
||||
import {
|
||||
WorkflowStep,
|
||||
WorkflowStepType,
|
||||
@ -19,6 +22,9 @@ export const useCreateStep = ({
|
||||
}: {
|
||||
workflow: WorkflowWithCurrentVersion;
|
||||
}) => {
|
||||
const { openRightDrawer } = useRightDrawer();
|
||||
const setWorkflowSelectedNode = useSetRecoilState(workflowSelectedNodeState);
|
||||
|
||||
const workflowCreateStepFromParentStepId = useRecoilValue(
|
||||
workflowCreateStepFromParentStepIdState,
|
||||
);
|
||||
@ -84,6 +90,9 @@ export const useCreateStep = ({
|
||||
nodeToAdd: newStep,
|
||||
});
|
||||
|
||||
setWorkflowSelectedNode(newStep.id);
|
||||
openRightDrawer(RightDrawerPages.WorkflowStepEdit);
|
||||
|
||||
/**
|
||||
* After the step has been created, select it.
|
||||
* As the `insertNodeAndSave` function mutates the cached workflow before resolving,
|
||||
|
||||
Reference in New Issue
Block a user