Skip to content

Commit ab696d5

Browse files
committed
refactor: prefix the name of the state with "workflow" to emphasize its purpose
1 parent c97cd9b commit ab696d5

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

packages/twenty-front/src/modules/workflow/hooks/useRightDrawerWorkflowSelectAction.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useTabList } from '@/ui/layout/tab/hooks/useTabList';
22
import { useCreateNode } from '@/workflow/hooks/useCreateNode';
3-
import { createStepFromParentStepIdState } from '@/workflow/states/createStepFromParentStepIdState';
43
import { showPageWorkflowDiagramTriggerNodeSelectionState } from '@/workflow/states/showPageWorkflowDiagramTriggerNodeSelectionState';
4+
import { workflowCreateStepFropParentStepIdState } from '@/workflow/states/workflowCreateStepFromParentStepIdState';
55
import { Workflow } from '@/workflow/types/Workflow';
66
import { useRecoilValue, useSetRecoilState } from 'recoil';
77
import {
@@ -20,8 +20,8 @@ export const useRightDrawerWorkflowSelectAction = ({
2020
tabListId: string;
2121
workflow: Workflow;
2222
}) => {
23-
const createStepFromParentStepId = useRecoilValue(
24-
createStepFromParentStepIdState,
23+
const workflowCreateStepFropParentStepId = useRecoilValue(
24+
workflowCreateStepFropParentStepIdState,
2525
);
2626

2727
const setShowPageWorkflowDiagramTriggerNodeSelection = useSetRecoilState(
@@ -76,7 +76,7 @@ export const useRightDrawerWorkflowSelectAction = ({
7676
);
7777

7878
const handleActionClick = async (actionId: string) => {
79-
if (createStepFromParentStepId === undefined) {
79+
if (workflowCreateStepFropParentStepId === undefined) {
8080
throw new Error('Select a step to create a new step from first.');
8181
}
8282

@@ -86,7 +86,7 @@ export const useRightDrawerWorkflowSelectAction = ({
8686
* FIXME: For now, the data of the node to create are mostly static.
8787
*/
8888
await createNode({
89-
parentNodeId: createStepFromParentStepId,
89+
parentNodeId: workflowCreateStepFropParentStepId,
9090
nodeToAdd: {
9191
id: newNodeId,
9292
name: actionId,

packages/twenty-front/src/modules/workflow/hooks/useStartNodeCreation.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { useRightDrawer } from '@/ui/layout/right-drawer/hooks/useRightDrawer';
22
import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
3-
import { createStepFromParentStepIdState } from '@/workflow/states/createStepFromParentStepIdState';
3+
import { workflowCreateStepFropParentStepId } from '@/workflow/states/workflowCreateStepFropParentStepId';
44
import { useCallback } from 'react';
55
import { useSetRecoilState } from 'recoil';
66

77
export const useStartNodeCreation = () => {
88
const { openRightDrawer } = useRightDrawer();
99
const setCreateStepFromStepState = useSetRecoilState(
10-
createStepFromParentStepIdState,
10+
workflowCreateStepFropParentStepId,
1111
);
1212

1313
/**

packages/twenty-front/src/modules/workflow/states/createStepFromParentStepIdState.ts

-6
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { createState } from 'twenty-ui';
2+
3+
export const workflowCreateStepFropParentStepIdState = createState<
4+
string | undefined
5+
>({
6+
key: 'workflowCreateStepFropParentStepId',
7+
defaultValue: undefined,
8+
});

0 commit comments

Comments
 (0)