File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
frontend/src/components/canvas Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -74,14 +74,23 @@ function Flow({ className }: CanvasProps) {
7474 const initialNodes = Array . from ( nodesMap . values ( ) ) as Node [ ] ;
7575 setNodes ( initialNodes ) ;
7676
77+ let isInitialSync = true ;
78+
7779 nodesMap . observe ( ( event ) => {
80+ if ( isInitialSync ) {
81+ isInitialSync = false ;
82+ return ;
83+ }
84+
7885 event . changes . keys . forEach ( ( change , key ) => {
7986 const nodeId = key ;
8087 if ( change . action === "add" || change . action === "update" ) {
8188 const updatedNode = nodesMap . get ( nodeId ) as Node ;
8289
8390 if ( change . action === "add" ) {
84- queryClient . invalidateQueries ( { queryKey : [ "pages" ] } ) ;
91+ if ( ! existingPageIds . current . has ( nodeId ) ) {
92+ queryClient . invalidateQueries ( { queryKey : [ "pages" ] } ) ;
93+ }
8594 }
8695
8796 setNodes ( ( nds ) => {
You can’t perform that action at this time.
0 commit comments