|
1 | 1 | import { memo, useCallback } from 'react' |
2 | 2 | import { ArrowLeftRight, ArrowUpDown, Circle, CircleOff, Lock, LogOut, Unlock } from 'lucide-react' |
| 3 | +import { useShallow } from 'zustand/react/shallow' |
3 | 4 | import { Button, Copy, PlayOutline, Tooltip, Trash2 } from '@/components/emcn' |
4 | 5 | import { cn } from '@/lib/core/utils/cn' |
5 | 6 | import { isInputDefinitionTrigger } from '@/lib/workflows/triggers/input-definition-triggers' |
@@ -51,7 +52,7 @@ export const ActionBar = memo( |
51 | 52 | collaborativeBatchToggleBlockHandles, |
52 | 53 | collaborativeBatchToggleLocked, |
53 | 54 | } = useCollaborativeWorkflow() |
54 | | - const { setPendingSelection } = useWorkflowRegistry() |
| 55 | + const setPendingSelection = useWorkflowRegistry((state) => state.setPendingSelection) |
55 | 56 | const { handleRunFromBlock } = useWorkflowExecution() |
56 | 57 |
|
57 | 58 | const addNotification = useNotificationStore((s) => s.addNotification) |
@@ -94,26 +95,28 @@ export const ActionBar = memo( |
94 | 95 | isParentLocked, |
95 | 96 | isParentDisabled, |
96 | 97 | } = useWorkflowStore( |
97 | | - useCallback( |
98 | | - (state) => { |
99 | | - const block = state.blocks[blockId] |
100 | | - const parentId = block?.data?.parentId |
101 | | - const parentBlock = parentId ? state.blocks[parentId] : undefined |
102 | | - return { |
103 | | - isEnabled: block?.enabled ?? true, |
104 | | - horizontalHandles: block?.horizontalHandles ?? false, |
105 | | - parentId, |
106 | | - parentType: parentBlock?.type, |
107 | | - isLocked: block?.locked ?? false, |
108 | | - isParentLocked: parentBlock?.locked ?? false, |
109 | | - isParentDisabled: parentBlock ? !parentBlock.enabled : false, |
110 | | - } |
111 | | - }, |
112 | | - [blockId] |
| 98 | + useShallow( |
| 99 | + useCallback( |
| 100 | + (state) => { |
| 101 | + const block = state.blocks[blockId] |
| 102 | + const parentId = block?.data?.parentId |
| 103 | + const parentBlock = parentId ? state.blocks[parentId] : undefined |
| 104 | + return { |
| 105 | + isEnabled: block?.enabled ?? true, |
| 106 | + horizontalHandles: block?.horizontalHandles ?? false, |
| 107 | + parentId, |
| 108 | + parentType: parentBlock?.type, |
| 109 | + isLocked: block?.locked ?? false, |
| 110 | + isParentLocked: parentBlock?.locked ?? false, |
| 111 | + isParentDisabled: parentBlock ? !parentBlock.enabled : false, |
| 112 | + } |
| 113 | + }, |
| 114 | + [blockId] |
| 115 | + ) |
113 | 116 | ) |
114 | 117 | ) |
115 | 118 |
|
116 | | - const { activeWorkflowId } = useWorkflowRegistry() |
| 119 | + const activeWorkflowId = useWorkflowRegistry((state) => state.activeWorkflowId) |
117 | 120 | const isExecuting = useIsCurrentWorkflowExecuting() |
118 | 121 | const getLastExecutionSnapshot = useExecutionStore((s) => s.getLastExecutionSnapshot) |
119 | 122 | const userPermissions = useUserPermissionsContext() |
|
0 commit comments