Skip to content

Commit 14a691b

Browse files
committed
ack PR comments
1 parent 530e2ac commit 14a691b

File tree

2 files changed

+8
-21
lines changed

2 files changed

+8
-21
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/action-bar/action-bar.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,11 @@ export function ActionBar() {
5353
}
5454

5555
const handleHide = async () => {
56-
setContextMenu(null)
57-
await updateSetting.mutateAsync({ key: 'showActionBar', value: false })
56+
try {
57+
await updateSetting.mutateAsync({ key: 'showActionBar', value: false })
58+
} finally {
59+
setContextMenu(null)
60+
}
5861
}
5962

6063
if (!showActionBar) {

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ const WorkflowContent = React.memo(() => {
212212
const [potentialParentId, setPotentialParentId] = useState<string | null>(null)
213213
const [selectedEdges, setSelectedEdges] = useState<SelectedEdgesMap>(new Map())
214214
const [isShiftPressed, setIsShiftPressed] = useState(false)
215-
const [isSelectionDragActive, setIsSelectionDragActive] = useState(false)
216215
const [isErrorConnectionDrag, setIsErrorConnectionDrag] = useState(false)
217216
const canvasMode = useCanvasModeStore((state) => state.mode)
218217
const isHandMode = canvasMode === 'hand'
@@ -1928,7 +1927,6 @@ const WorkflowContent = React.memo(() => {
19281927
}
19291928
const handleFocusLoss = () => {
19301929
setIsShiftPressed(false)
1931-
setIsSelectionDragActive(false)
19321930
}
19331931
const handleVisibilityChange = () => {
19341932
if (document.hidden) {
@@ -2843,17 +2841,6 @@ const WorkflowContent = React.memo(() => {
28432841
]
28442842
)
28452843

2846-
// Lock selection mode when selection drag starts (captures Shift state at drag start)
2847-
const onSelectionStart = useCallback(() => {
2848-
if (isShiftPressed) {
2849-
setIsSelectionDragActive(true)
2850-
}
2851-
}, [isShiftPressed])
2852-
2853-
const onSelectionEnd = useCallback(() => {
2854-
requestAnimationFrame(() => setIsSelectionDragActive(false))
2855-
}, [])
2856-
28572844
/** Captures initial positions when selection drag starts (for marquee-selected nodes). */
28582845
const onSelectionDragStart = useCallback(
28592846
(_event: React.MouseEvent, nodes: Node[]) => {
@@ -3003,7 +2990,6 @@ const WorkflowContent = React.memo(() => {
30032990

30042991
const onSelectionDragStop = useCallback(
30052992
(_event: React.MouseEvent, nodes: any[]) => {
3006-
requestAnimationFrame(() => setIsSelectionDragActive(false))
30072993
clearDragHighlights()
30082994
if (nodes.length === 0) return
30092995

@@ -3311,9 +3297,9 @@ const WorkflowContent = React.memo(() => {
33113297
edgeTypes={edgeTypes}
33123298
onDrop={effectivePermissions.canEdit ? onDrop : undefined}
33133299
onDragOver={effectivePermissions.canEdit ? onDragOver : undefined}
3314-
onInit={() => {
3300+
onInit={(instance) => {
33153301
requestAnimationFrame(() => {
3316-
fitViewToBounds({ padding: 0.1, maxZoom: 1.0 })
3302+
instance.fitView(reactFlowFitViewOptions)
33173303
setIsCanvasReady(true)
33183304
})
33193305
}}
@@ -3334,11 +3320,9 @@ const WorkflowContent = React.memo(() => {
33343320
onPointerMove={handleCanvasPointerMove}
33353321
onPointerLeave={handleCanvasPointerLeave}
33363322
elementsSelectable={true}
3337-
selectionOnDrag={!isHandMode || isSelectionDragActive}
3323+
selectionOnDrag={!isHandMode}
33383324
selectionMode={SelectionMode.Partial}
33393325
panOnDrag={isHandMode ? [0, 1] : false}
3340-
onSelectionStart={onSelectionStart}
3341-
onSelectionEnd={onSelectionEnd}
33423326
multiSelectionKeyCode={['Meta', 'Control', 'Shift']}
33433327
nodesConnectable={effectivePermissions.canEdit}
33443328
nodesDraggable={effectivePermissions.canEdit}

0 commit comments

Comments
 (0)