From 4e9c17d98e0a3c33591f16b3fd60ef368447830a Mon Sep 17 00:00:00 2001 From: dextmorgn Date: Mon, 17 Nov 2025 00:21:01 +0100 Subject: [PATCH] feat(app): fix node positions --- flowsint-app/src/components/graphs/graph-main.tsx | 1 - flowsint-app/src/components/graphs/graph-viewer.tsx | 3 --- flowsint-app/src/hooks/use-save-node-positions.ts | 3 +++ 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/flowsint-app/src/components/graphs/graph-main.tsx b/flowsint-app/src/components/graphs/graph-main.tsx index 893bc66..62b320d 100644 --- a/flowsint-app/src/components/graphs/graph-main.tsx +++ b/flowsint-app/src/components/graphs/graph-main.tsx @@ -75,7 +75,6 @@ const GraphMain = () => { showIcons={true} onGraphRef={handleGraphRef} allowLasso - minimap={false} sketchId={sketchId} /> diff --git a/flowsint-app/src/components/graphs/graph-viewer.tsx b/flowsint-app/src/components/graphs/graph-viewer.tsx index 1f65c33..c27a7b1 100644 --- a/flowsint-app/src/components/graphs/graph-viewer.tsx +++ b/flowsint-app/src/components/graphs/graph-viewer.tsx @@ -34,7 +34,6 @@ interface GraphViewerProps { onGraphRef?: (ref: any) => void instanceId?: string // Add instanceId prop for instance-specific actions allowLasso?: boolean - minimap?: boolean sketchId?: string // Add sketchId for saving node positions } @@ -150,7 +149,6 @@ const GraphViewer: React.FC = ({ onGraphRef, instanceId, allowLasso = false, - minimap = false, sketchId }) => { const [containerSize, setContainerSize] = useState({ width: 0, height: 0 }) @@ -181,7 +179,6 @@ const GraphViewer: React.FC = ({ // Store selectors const nodeColors = useNodesDisplaySettings((s) => s.colors) const getSize = useNodesDisplaySettings((s) => s.getSize) - const view = useGraphControls((s) => s.view) // Get settings by categories to avoid re-renders const forceSettings = useGraphSettingsStore((s) => s.forceSettings) diff --git a/flowsint-app/src/hooks/use-save-node-positions.ts b/flowsint-app/src/hooks/use-save-node-positions.ts index ab45d20..ee52880 100644 --- a/flowsint-app/src/hooks/use-save-node-positions.ts +++ b/flowsint-app/src/hooks/use-save-node-positions.ts @@ -2,6 +2,7 @@ import { useCallback, useEffect, useRef, useState } from 'react' import { useDebounce } from './use-debounce' import { sketchService } from '@/api/sketch-service' import { useGraphSaveStatus } from '@/stores/graph-save-status-store' +import { useGraphStore } from '@/stores/graph-store' interface NodePosition { x: number @@ -16,6 +17,7 @@ export type SaveStatus = 'idle' | 'pending' | 'saving' | 'saved' | 'error' */ export function useSaveNodePositions(sketchId?: string) { const [changedNodePositions, setChangedNodePositions] = useState>(new Map()) + const setNodes = useGraphStore(s => s.setNodes) const isStabilizingRef = useRef(false) // Start as false, mark as true only during layout regeneration const setSaveStatus = useGraphSaveStatus((state) => state.setSaveStatus) @@ -68,6 +70,7 @@ export function useSaveNodePositions(sketchId?: string) { if (newMap.size > 0) { setChangedNodePositions(newMap) + setNodes(nodes) setSaveStatus('pending') } }, [sketchId])