@@ -17,19 +17,20 @@ import {
1717 ReactFlowProvider ,
1818} from "@xyflow/react" ;
1919import "@xyflow/react/dist/style.css" ;
20- import { usePages } from "@/hooks/usePages" ;
21- import { NoteNode } from "./NoteNode" ;
2220import * as Y from "yjs" ;
21+ import ELK from "elkjs" ;
2322import { SocketIOProvider } from "y-socket.io" ;
24- import { cn } from "@/lib/utils" ;
2523import { useQueryClient } from "@tanstack/react-query" ;
24+
25+ import { CollaborativeCursors } from "../CursorView" ;
26+ import { NoteNode } from "./NoteNode" ;
27+
28+ import { usePages } from "@/hooks/usePages" ;
29+ import { cn } from "@/lib/utils" ;
2630import useYDocStore from "@/store/useYDocStore" ;
2731import { useCollaborativeCursors } from "@/hooks/useCursor" ;
28- import { CollaborativeCursors } from "../CursorView" ;
2932import { calculateBestHandles } from "@/lib/calculateBestHandles" ;
3033
31- import ELK from "elkjs" ;
32-
3334const elk = new ELK ( ) ;
3435
3536const proOptions = { hideAttribution : true } ;
@@ -232,6 +233,12 @@ function Flow({ className }: CanvasProps) {
232233 } ;
233234 } ) ;
234235
236+ const nodesMap = ydoc . getMap ( "nodes" ) ;
237+
238+ updatedNodes . forEach ( ( updateNode ) => {
239+ nodesMap . set ( updateNode . id , updateNode ) ;
240+ } ) ;
241+
235242 setNodes ( updatedNodes ) ;
236243 } ;
237244
@@ -374,17 +381,8 @@ function Flow({ className }: CanvasProps) {
374381 selectNodesOnDrag = { false }
375382 >
376383 < Controls />
377- < div
378- id = "layout-button"
379- style = { {
380- display : "flex" ,
381- justifyContent : "center" ,
382- marginBottom : "10px" ,
383- zIndex : 999 ,
384- position : "relative" ,
385- } }
386- >
387- < button onClick = { performLayout } > Layout</ button >
384+ < div className = "fixed bottom-5 left-16 z-30 h-4 w-4 text-neutral-50 hover:cursor-pointer" >
385+ < button onClick = { performLayout } > Sort</ button >
388386 </ div >
389387 < MiniMap />
390388 < Background variant = { BackgroundVariant . Dots } gap = { 12 } size = { 1 } />
0 commit comments