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

This commit is contained in:
SiriusXT 2025-12-05 15:21:06 +08:00
parent 85b4f652f4
commit 2d33b8a958

View File

@ -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">