Skip to content

Build your personal knowledge base with Trilium Notes

fix(note_map): initialize map state when switching map type in ribbon

SiriusXT2d33b8a9586a
diff --git a/apps/client/src/widgets/note_map/NoteMap.tsx b/apps/client/src/widgets/note_map/NoteMap.tsx
index 4e466a5638..12e15202d2 100644
--- a/apps/client/src/widgets/note_map/NoteMap.tsx
+++ b/apps/client/src/widgets/note_map/NoteMap.tsx
@@ -95,7 +95,7 @@ export default function NoteMap({ note, widgetMode, parentRef }: NoteMapProps) {
if (!graphRef.current || !notesAndRelationsRef.current) return;
graphRef.current.d3Force("link")?.distance(linkDistance);
graphRef.current.graphData(notesAndRelationsRef.current);
- }, [ linkDistance ]);
+ }, [ linkDistance, mapType ]);
// React to container size
useEffect(() => {
@@ -114,7 +114,7 @@ export default function NoteMap({ note, widgetMode, parentRef }: NoteMapProps) {
node.fy = undefined;
}
})
- }, [ fixNodes ]);
+ }, [ fixNodes, mapType ]);
return (
<div className="note-map-widget">