A modern platform for visual, flexible, and extensible graph-based investigations. For cybersecurity analysts and investigators.
feat: rebase main
dextmorgnc21db239ac10
diff --git a/flowsint-app/src/api/sketch-service.ts b/flowsint-app/src/api/sketch-service.tsindex f3efd77b..ce9642bf 100644--- a/flowsint-app/src/api/sketch-service.ts+++ b/flowsint-app/src/api/sketch-service.ts@@ -95,5 +95,14 @@ export const sketchService = {method: 'POST',body: formData})+ },+ updateNodePositions: async (+ sketchId: string,+ positions: Array<{ nodeId: string; x: number; y: number }>+ ): Promise<any> => {+ return fetchWithAuth(`/api/sketches/${sketchId}/nodes/positions`, {+ method: 'PUT',+ body: JSON.stringify({ positions })+ })}}diff --git a/flowsint-app/src/components/graphs/graph-main.tsx b/flowsint-app/src/components/graphs/graph-main.tsxindex d934a461..5797c467 100644--- a/flowsint-app/src/components/graphs/graph-main.tsx+++ b/flowsint-app/src/components/graphs/graph-main.tsx@@ -5,8 +5,10 @@ import React, { useRef, useCallback } from 'react'import ContextMenu from './context-menu'import { useGraphControls } from '@/stores/graph-controls-store'import GraphViewer from './graph-viewer'+import { useParams } from '@tanstack/react-router'const GraphMain = () => {+ const { id: sketchId } = useParams({ strict: false })const filteredNodes = useGraphStore((s) => s.filteredNodes)const filteredEdges = useGraphStore((s) => s.filteredEdges)const toggleNodeSelection = useGraphStore((s) => s.toggleNodeSelection)@@ -76,6 +78,7 @@ const GraphMain = () => {onGraphRef={handleGraphRef}allowLassominimap={false}+ sketchId={sketchId}/>{menu && <ContextMenu onClick={handleBackgroundClick} {...menu} />}diff --git a/flowsint-app/src/components/graphs/graph-viewer.tsx b/flowsint-app/src/components/graphs/graph-viewer.tsxindex 481f3a5d..63145f5c 100644--- a/flowsint-app/src/components/graphs/graph-viewer.tsx+++ b/flowsint-app/src/components/graphs/graph-viewer.tsx@@ -10,7 +10,9 @@ import { useTheme } from '@/components/theme-provider'import { Info, Plus, Share2, Type, Upload } from 'lucide-react'import Lasso from './lasso'import { GraphNode, GraphEdge } from '@/types'-import MiniMap from './minimap'+import { sketchService } from '@/api/sketch-service'+import { useDebounce } from '@/hooks/use-debounce'+import { toast } from 'sonner'function truncateText(text: string, limit: number = 16) {if (text.length <= limit) return text@@ -35,6 +37,7 @@ interface GraphViewerProps {instanceId?: string // Add instanceId prop for instance-specific actionsallowLasso?: booleanminimap?: boolean+ sketchId?: string // Add sketchId for saving node positions}// Graph viewer specific colors@@ -97,9 +100,6 @@ interface LabelRenderingCompound {}}-// Pre-computed constants-const LABEL_FONT_STRING = `${CONSTANTS.LABEL_FONT_SIZE}px Sans-Serif`-// Reusable objects to avoid allocationsconst tempPos = { x: 0, y: 0 }const tempDimensions = [0, 0]@@ -152,7 +152,8 @@ const GraphViewer: React.FC<GraphViewerProps> = ({onGraphRef,instanceId,allowLasso = false,- minimap = false+ minimap = false,+ sketchId}) => {const [containerSize, setContainerSize] = useState({ width: 0, height: 0 })const isLassoActive = useGraphControls((s) => s.isLassoActive)@@ -163,6 +164,10 @@ const GraphViewer: React.FC<GraphViewerProps> = ({const [currentZoom, setCurrentZoom] = useState<number>(1)const zoomRef = useRef({ k: 1, x: 0, y: 0 })const hoverFrameRef = useRef<number | null>(null)++ // Node position tracking for saving+ const [changedNodePositions, setChangedNodePositions] = useState<Map<string, { x: number; y: number }>>(new Map())+ const [isStabilizing, setIsStabilizing] = useState(true)// The ref for the node weighlist.const labelRenderingCompound = useRef<LabelRenderingCompound>({weightList: new Map(),@@ -189,6 +194,9 @@ const GraphViewer: React.FC<GraphViewerProps> = ({const setOpenMainDialog = useGraphStore((state) => state.setOpenMainDialog)const setImportModalOpen = useGraphSettingsStore((s) => s.setImportModalOpen)+ // Debounced value to trigger save+ const debouncedChangedPositions = useDebounce(changedNodePositions, 1000)+const shouldUseSimpleRendering = useMemo(() => nodes.length > CONSTANTS.NODE_COUNT_THRESHOLD || currentZoom < 1.5,[nodes.length, currentZoom]@@ -245,9 +253,10 @@ const GraphViewer: React.FC<GraphViewerProps> = ({const graph2ScreenCoords = useCallback((node: GraphNode) => {+ if (!graphRef.current) return { x: 0, y: 0 }return graphRef.current.graph2ScreenCoords(node.x, node.y)},- [graphRef.current]+ [])const isCurrent = useCallback(@@ -283,79 +292,6 @@ const GraphViewer: React.FC<GraphViewerProps> = ({}}, [currentZoom])- // Optimized graph initialization callback- const initializeGraph = useCallback(- (graphInstance: any) => {- if (!graphInstance) return- // Check if the graph instance has the required methods- if (- typeof graphInstance.zoom !== 'function' ||- typeof graphInstance.zoomToFit !== 'function'- ) {- // If methods aren't available yet, retry after a short delay- setTimeout(() => {- if (graphRef.current && !isGraphReadyRef.current) {- initializeGraph(graphRef.current)- }- }, 100)- return- }- if (isGraphReadyRef.current) return- isGraphReadyRef.current = true- // Only set global actions if no instanceId is provided (for main graph)- if (!instanceId) {- setActions({- zoomIn: () => {- if (graphRef.current && typeof graphRef.current.zoom === 'function') {- const zoom = graphRef.current.zoom()- graphRef.current.zoom(zoom * 1.5)- }- },- zoomOut: () => {- if (graphRef.current && typeof graphRef.current.zoom === 'function') {- const zoom = graphRef.current.zoom()- graphRef.current.zoom(zoom * 0.75)- }- },- zoomToFit: () => {- if (graphRef.current && typeof graphRef.current.zoomToFit === 'function') {- graphRef.current.zoomToFit(400)- }- }- })- }- // Call external ref callback- onGraphRef?.(graphInstance)- },- [setActions, onGraphRef, instanceId]- )-- // Handle graph ref changes and ensure actions are set up- useEffect(() => {- if (graphRef.current) {- initializeGraph(graphRef.current)- }- // Cleanup: reset actions when component unmounts (only for main graph)- return () => {- if (!instanceId && isGraphReadyRef.current) {- setActions({- zoomIn: () => { },- zoomOut: () => { },- zoomToFit: () => { }- })- isGraphReadyRef.current = false- }- }- }, [initializeGraph])-- // Additional effect to ensure actions are set up when graph is ready- useEffect(() => {- if (graphRef.current && !instanceId && !isGraphReadyRef.current) {- // Try to initialize again if the graph is available but not marked as ready- initializeGraph(graphRef.current)- }- }, [graphRef.current, initializeGraph, instanceId])-// Handle container size changesuseEffect(() => {const updateSize = () => {@@ -387,7 +323,7 @@ const GraphViewer: React.FC<GraphViewerProps> = ({// Transform nodesconst transformedNodes = nodes.map((node) => {const type = node.data?.type as ItemType- return {+ const transformed = {...node,nodeLabel: node.data?.label || node.id,nodeColor: nodeColors[type] || GRAPH_COLORS.NODE_DEFAULT,@@ -397,6 +333,16 @@ const GraphViewer: React.FC<GraphViewerProps> = ({neighbors: [] as any[],links: [] as any[]} as GraphNode & { neighbors: any[]; links: any[] }++ // If node has saved positions, fix them so ForceGraph doesn't recalculate+ if (node.x !== undefined && node.y !== undefined) {+ // @ts-ignore+ transformed.fx = node.x+ // @ts-ignore+ transformed.fy = node.y+ }++ return transformed})// Create a map for quick node lookupconst nodeMap = new Map(transformedNodes.map((node) => [node.id, node]))@@ -447,42 +393,132 @@ const GraphViewer: React.FC<GraphViewerProps> = ({.map((node) => [node.id, node.neighbors.length]))labelRenderingCompound.current.constants = { nodesLength: transformedNodes.length }- // Handle hierarchy layout- if (view === 'hierarchy') {- const { nodes: nds, edges: eds } = getDagreLayoutedElements(- transformedNodes,- transformedEdges- )- return {- nodes: nds.map((nd) => ({- ...nd,- // Preserve the neighbors and links from the original transformed node- neighbors: nodeMap.get(nd.id)?.neighbors || [],- links: nodeMap.get(nd.id)?.links || []- })),- links: eds- }- }++ // Always use force layout - positions are preserved if they exist (fx/fy set above)return {nodes: transformedNodes,links: transformedEdges}- }, [nodes, edges, nodeColors, getSize, view])+ }, [nodes, edges, nodeColors, getSize])- // Retry initialization if graph data changes and actions aren't set up- useEffect(() => {- if (graphData.nodes.length > 0 && graphRef.current && !instanceId && !isGraphReadyRef.current) {- // Small delay to ensure the graph has rendered- const timeoutId = setTimeout(() => {- if (graphRef.current && !isGraphReadyRef.current) {- initializeGraph(graphRef.current)+ // Regenerate layout by removing fixed positions and reheating simulation+ const regenerateLayout = useCallback((layoutType: 'force' | 'hierarchy') => {+ if (!graphRef.current) {+ console.error('[Graph] graphRef.current is null')+ throw new Error('Graph reference is not available')+ }++ if (!graphData || !graphData.nodes) {+ console.error('[Graph] No nodes in graph data')+ throw new Error('No nodes available in graph')+ }++ // Remove fx and fy from all nodes to allow repositioning+ graphData.nodes.forEach((node: any) => {+ delete node.fx+ delete node.fy+ })++ if (layoutType === 'hierarchy') {+ // Apply dagre layout for hierarchical positioning+ const { nodes: layoutedNodes } = getDagreLayoutedElements(+ graphData.nodes,+ graphData.links+ )++ // Apply the calculated positions to the graph nodes+ layoutedNodes.forEach((layoutedNode: any) => {+ const graphNode = graphData.nodes.find((n: any) => n.id === layoutedNode.id)+ if (graphNode && layoutedNode.x !== undefined && layoutedNode.y !== undefined) {+ graphNode.x = layoutedNode.x+ graphNode.y = layoutedNode.y+ graphNode.fx = layoutedNode.x+ graphNode.fy = layoutedNode.y}- }, 200)- return () => clearTimeout(timeoutId)+ })+ } else {+ // Force layout: reheat the simulation to recalculate positions+ if (typeof graphRef.current.d3ReheatSimulation !== 'function') {+ console.error('[Graph] d3ReheatSimulation method not available')+ throw new Error('d3ReheatSimulation method is not available')+ }++ graphRef.current.d3ReheatSimulation()}- return undefined- }, [graphData.nodes.length, initializeGraph, instanceId])+ // Zoom to fit after a delay to see the new layout+ setTimeout(() => {+ if (graphRef.current && typeof graphRef.current.zoomToFit === 'function') {+ graphRef.current.zoomToFit(400)+ }+ }, 500)+ }, [graphData])++ // Optimized graph initialization callback+ const initializeGraph = useCallback(+ (graphInstance: any) => {+ if (!graphInstance) return+ // Check if the graph instance has the required methods+ if (+ typeof graphInstance.zoom !== 'function' ||+ typeof graphInstance.zoomToFit !== 'function'+ ) {+ // If methods aren't available yet, retry after a short delay+ setTimeout(() => {+ if (graphRef.current && !isGraphReadyRef.current) {+ initializeGraph(graphRef.current)+ }+ }, 100)+ return+ }+ if (isGraphReadyRef.current) return+ isGraphReadyRef.current = true+ // Only set global actions if no instanceId is provided (for main graph)+ if (!instanceId) {+ setActions({+ zoomIn: () => {+ if (graphRef.current && typeof graphRef.current.zoom === 'function') {+ const zoom = graphRef.current.zoom()+ graphRef.current.zoom(zoom * 1.5)+ }+ },+ zoomOut: () => {+ if (graphRef.current && typeof graphRef.current.zoom === 'function') {+ const zoom = graphRef.current.zoom()+ graphRef.current.zoom(zoom * 0.75)+ }+ },+ zoomToFit: () => {+ if (graphRef.current && typeof graphRef.current.zoomToFit === 'function') {+ graphRef.current.zoomToFit(400)+ }+ },+ regenerateLayout: regenerateLayout+ })+ }+ // Call external ref callback+ onGraphRef?.(graphInstance)+ },+ [setActions, onGraphRef, instanceId, regenerateLayout]+ )++ // Initialize graph once ready+ useEffect(() => {+ if (graphRef.current) {+ initializeGraph(graphRef.current)+ }+ return () => {+ if (!instanceId && isGraphReadyRef.current) {+ setActions({+ zoomIn: () => { },+ zoomOut: () => { },+ zoomToFit: () => { },+ regenerateLayout: () => { }+ })+ isGraphReadyRef.current = false+ }+ }+ }, [initializeGraph, instanceId, setActions])// Event handlers with proper memoizationconst handleNodeClick = useCallback(@@ -511,6 +547,21 @@ const GraphViewer: React.FC<GraphViewerProps> = ({setImportModalOpen(true)}, [setImportModalOpen])+ // Handle node drag end with position tracking+ const handleNodeDragEnd = useCallback((node: any) => {+ node.fx = node.x+ node.fy = node.y++ // Track position changes for saving (only if not stabilizing and sketchId exists)+ if (!isStabilizing && sketchId && node.x !== undefined && node.y !== undefined) {+ setChangedNodePositions(prev => {+ const newMap = new Map(prev)+ newMap.set(node.id, { x: node.x!, y: node.y! })+ return newMap+ })+ }+ }, [isStabilizing, sketchId])+// Throttled hover handlers using RAF for better performanceconst handleNodeHover = useCallback((node: any) => {@@ -579,8 +630,8 @@ const GraphViewer: React.FC<GraphViewerProps> = ({y,data: {label,- type: node.data.type,- connections: weight+ type: node.data?.type || 'unknown',+ connections: weight.toString()},visible: true})@@ -943,6 +994,49 @@ const GraphViewer: React.FC<GraphViewerProps> = ({}}, [])+ // Mark graph as stabilized after warmupTicks+ useEffect(() => {+ const warmupTicks = forceSettings?.warmupTicks?.value ?? 0+ if (warmupTicks > 0) {+ setIsStabilizing(true)+ // Wait for warmup + a small buffer to ensure graph has stabilized+ const timeout = setTimeout(() => {+ setIsStabilizing(false)+ }, warmupTicks * 10 + 500) // Approximate time for warmup ticks++ return () => clearTimeout(timeout)+ } else {+ setIsStabilizing(false)+ }+ }, [forceSettings?.warmupTicks?.value, nodes.length, edges.length])++ // Save positions when debounced value changes+ useEffect(() => {+ if (isStabilizing || !sketchId || debouncedChangedPositions.size === 0) {+ return+ }++ const positions = Array.from(debouncedChangedPositions.entries()).map(([nodeId, pos]) => ({+ nodeId,+ x: pos.x,+ y: pos.y+ }))++ const savePromise = sketchService.updateNodePositions(sketchId, positions)++ toast.promise(savePromise, {+ loading: `Saving positions for ${positions.length} node${positions.length > 1 ? 's' : ''}...`,+ success: (result) => {+ setChangedNodePositions(new Map())+ return `Successfully saved ${result.count || positions.length} node position${positions.length > 1 ? 's' : ''}`+ },+ error: (error) => {+ console.error('[Graph] Failed to save node positions:', error)+ return 'Failed to save node positions. Please try again.'+ }+ })+ }, [debouncedChangedPositions, isStabilizing, sketchId])+// Empty stateif (!nodes.length) {return (@@ -1051,11 +1145,8 @@ const GraphViewer: React.FC<GraphViewerProps> = ({onBackgroundClick={handleBackgroundClick}linkCurvature={(link) => link.curvature || 0}nodeCanvasObject={renderNode}- onNodeDragEnd={(node) => {- node.fx = node.x- node.fy = node.y- }}- cooldownTicks={view === 'hierarchy' ? 0 : forceSettings.cooldownTicks.value}+ onNodeDragEnd={handleNodeDragEnd}+ cooldownTicks={forceSettings.cooldownTicks.value}cooldownTime={forceSettings.cooldownTime.value}d3AlphaDecay={forceSettings.d3AlphaDecay.value}d3AlphaMin={forceSettings.d3AlphaMin.value}diff --git a/flowsint-app/src/components/graphs/toolbar.tsx b/flowsint-app/src/components/graphs/toolbar.tsxindex d545c431..03529a92 100644--- a/flowsint-app/src/components/graphs/toolbar.tsx+++ b/flowsint-app/src/components/graphs/toolbar.tsx@@ -21,6 +21,7 @@ import { toast } from 'sonner'import { cn } from '@/lib/utils'import Filters from './filters'import { useGraphStore } from '@/stores/graph-store'+import { useConfirm } from '@/components/use-confirm-dialog'// Tooltip wrapper component to avoid repetitionexport const ToolbarButton = memo(function ToolbarButton({@@ -67,12 +68,13 @@ export const ToolbarButton = memo(function ToolbarButton({)})export const Toolbar = memo(function Toolbar({ isLoading }: { isLoading: boolean }) {+ const { confirm } = useConfirm()const view = useGraphControls((s) => s.view)const setView = useGraphControls((s) => s.setView)const zoomToFit = useGraphControls((s) => s.zoomToFit)const zoomIn = useGraphControls((s) => s.zoomIn)const zoomOut = useGraphControls((s) => s.zoomOut)- const onLayout = useGraphControls((s) => s.onLayout)+ const regenerateLayout = useGraphControls((s) => s.regenerateLayout)const refetchGraph = useGraphControls((s) => s.refetchGraph)const isLassoActive = useGraphControls((s) => s.isLassoActive)const setIsLassoActive = useGraphControls((s) => s.setIsLassoActive)@@ -87,12 +89,57 @@ export const Toolbar = memo(function Toolbar({ isLoading }: { isLoading: boolean} catch (error) {toast.error('Failed to refresh graph data')}- }, [refetchGraph, onLayout])+ }, [refetchGraph])- const handleForceLayout = useCallback(() => {- setView('force')- setTimeout(() => zoomToFit(), 500)- }, [setView, zoomToFit])+ const handleRegenerateForceLayout = useCallback(async () => {+ console.log('[Toolbar] handleRegenerateForceLayout called')+ console.log('[Toolbar] regenerateLayout function:', regenerateLayout)+ console.log('[Toolbar] regenerateLayout is function?', typeof regenerateLayout === 'function')++ const confirmed = await confirm({+ title: 'Regenerate force layout?',+ message: 'This will reset all node positions and regenerate them using the force-directed layout algorithm. Current positions will be lost.'+ })++ if (!confirmed) {+ console.log('[Toolbar] User cancelled regeneration')+ return+ }++ console.log('[Toolbar] Calling regenerateLayout with force')+ try {+ regenerateLayout('force')+ console.log('[Toolbar] regenerateLayout completed successfully')+ toast.success('Force layout regenerated successfully')+ } catch (error) {+ console.error('[Toolbar] Failed to regenerate layout:', error)+ toast.error(`Failed to regenerate layout: ${error instanceof Error ? error.message : 'Unknown error'}`)+ }+ }, [confirm, regenerateLayout])++ const handleRegenerateHierarchyLayout = useCallback(async () => {+ console.log('[Toolbar] handleRegenerateHierarchyLayout called')++ const confirmed = await confirm({+ title: 'Regenerate hierarchy layout?',+ message: 'This will reset all node positions and regenerate them using the hierarchical layout algorithm. Current positions will be lost.'+ })++ if (!confirmed) {+ console.log('[Toolbar] User cancelled regeneration')+ return+ }++ console.log('[Toolbar] Calling regenerateLayout with hierarchy')+ try {+ regenerateLayout('hierarchy')+ console.log('[Toolbar] regenerateLayout completed successfully')+ toast.success('Hierarchy layout regenerated successfully')+ } catch (error) {+ console.error('[Toolbar] Failed to regenerate layout:', error)+ toast.error(`Failed to regenerate layout: ${error instanceof Error ? error.message : 'Unknown error'}`)+ }+ }, [confirm, regenerateLayout])const handleTableLayout = useCallback(() => {setView('table')@@ -106,12 +153,6 @@ export const Toolbar = memo(function Toolbar({ isLoading }: { isLoading: booleansetView('relationships')}, [setView])- const handleDagreLayoutTB = useCallback(() => {- setView('hierarchy')- onLayout && onLayout('dagre-tb')- setTimeout(() => zoomToFit(), 200)- }, [onLayout, setView, zoomToFit])-const handleOpenAddRelationDialog = useCallback(() => {setOpenAddRelationDialog(true)}, [setOpenAddRelationDialog])@@ -154,26 +195,26 @@ export const Toolbar = memo(function Toolbar({ isLoading }: { isLoading: booleanicon={<ZoomIn className="h-4 w-4 opacity-70" />}tooltip="Zoom In"onClick={zoomIn}- disabled={!['force', 'hierarchy'].includes(view) || isLassoActive}+ disabled={view !== 'force' || isLassoActive}/><ToolbarButtonicon={<Minus className="h-4 w-4 opacity-70" />}tooltip="Zoom Out"onClick={zoomOut}- disabled={!['force', 'hierarchy'].includes(view) || isLassoActive}+ disabled={view !== 'force' || isLassoActive}/><ToolbarButtonicon={<Maximize className="h-4 w-4 opacity-70" />}tooltip="Fit to View"onClick={zoomToFit}- disabled={!['force', 'hierarchy'].includes(view) || isLassoActive}+ disabled={view !== 'force' || isLassoActive}/><ToolbarButtonicon={<LassoSelect className="h-4 w-4 opacity-70" />}tooltip={'Lasso select'}onClick={handleLassoSelect}toggled={isLassoActive}- disabled={!['force', 'hierarchy'].includes(view)}+ disabled={view !== 'force'}/><Filters><ToolbarButton@@ -195,15 +236,15 @@ export const Toolbar = memo(function Toolbar({ isLoading }: { isLoading: boolean<TooltipProvider><ToolbarButtonicon={<GitFork className="h-4 w-4 opacity-70 rotate-180" />}- tooltip={`Hierarchy`}- toggled={['hierarchy'].includes(view)}- onClick={handleDagreLayoutTB}+ tooltip={'Regenerate hierarchy layout'}+ onClick={handleRegenerateHierarchyLayout}+ disabled={isLoading}/><ToolbarButtonicon={<Waypoints className="h-4 w-4 opacity-70" />}- tooltip={'Graph view'}- toggled={['force'].includes(view)}- onClick={handleForceLayout}+ tooltip={'Regenerate force layout'}+ onClick={handleRegenerateForceLayout}+ disabled={isLoading}/><ToolbarButtonicon={<List className="h-4 w-4 opacity-70" />}diff --git a/flowsint-app/src/stores/graph-controls-store.ts b/flowsint-app/src/stores/graph-controls-store.tsindex e6d956d3..407f1787 100644--- a/flowsint-app/src/stores/graph-controls-store.ts+++ b/flowsint-app/src/stores/graph-controls-store.ts@@ -2,11 +2,9 @@ import { create } from 'zustand'import { persist } from 'zustand/middleware'type ViewType = 'hierarchy' | 'force' | 'table' | 'map' | 'relationships'-type LayoutMode = 'none' | 'force' | 'dagre'type GraphControlsStore = {view: ViewType- layoutMode: LayoutModeisLassoActive: booleanzoomToFit: () => voidzoomIn: () => void@@ -14,8 +12,8 @@ type GraphControlsStore = {onLayout: (layout: any) => voidsetActions: (actions: Partial<GraphControlsStore>) => voidrefetchGraph: () => void- setView: (view: ViewType) => void- setLayoutMode: (mode: LayoutMode) => void+ regenerateLayout: (layoutType: 'force' | 'hierarchy') => void+ setView: (view: 'force' | 'hierarchy' | 'table' | 'map' | 'relationships') => voidsetIsLassoActive: (active: boolean) => void}@@ -23,7 +21,6 @@ export const useGraphControls = create<GraphControlsStore>()(persist((set) => ({view: 'force',- layoutMode: 'none',isLassoActive: false,zoomToFit: () => { },zoomIn: () => { },@@ -31,13 +28,13 @@ export const useGraphControls = create<GraphControlsStore>()(onLayout: () => { },setActions: (actions) => set(actions),refetchGraph: () => { },+ regenerateLayout: () => { },setView: (view) => set({ view }),- setLayoutMode: (mode) => set({ layoutMode: mode }),setIsLassoActive: (active) => set({ isLassoActive: active })}),{name: 'graph-controls-storage',- partialize: (state) => ({ view: state.view, layoutMode: state.layoutMode })+ partialize: (state) => ({ view: state.view })}))