Enforce front project structure through ESLINT (#7863)
Fixes: https://github.com/twentyhq/twenty/issues/7329
This commit is contained in:
@ -0,0 +1,29 @@
|
||||
import { useRightDrawer } from '@/ui/layout/right-drawer/hooks/useRightDrawer';
|
||||
import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
|
||||
import { workflowCreateStepFromParentStepIdState } from '@/workflow/states/workflowCreateStepFromParentStepIdState';
|
||||
import { useCallback } from 'react';
|
||||
import { useSetRecoilState } from 'recoil';
|
||||
|
||||
export const useStartNodeCreation = () => {
|
||||
const { openRightDrawer } = useRightDrawer();
|
||||
const setWorkflowCreateStepFromParentStepId = useSetRecoilState(
|
||||
workflowCreateStepFromParentStepIdState,
|
||||
);
|
||||
|
||||
/**
|
||||
* This function is used in a context where dependencies shouldn't change much.
|
||||
* That's why its wrapped in a `useCallback` hook. Removing memoization might break the app unexpectedly.
|
||||
*/
|
||||
const startNodeCreation = useCallback(
|
||||
(parentNodeId: string) => {
|
||||
setWorkflowCreateStepFromParentStepId(parentNodeId);
|
||||
|
||||
openRightDrawer(RightDrawerPages.WorkflowStepSelectAction);
|
||||
},
|
||||
[openRightDrawer, setWorkflowCreateStepFromParentStepId],
|
||||
);
|
||||
|
||||
return {
|
||||
startNodeCreation,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user