Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix(type_widgets/relation_map): map emptied when switching fast
Elian Dorand4194c503c14
diff --git a/apps/client/src/widgets/type_widgets/relation_map/RelationMap.tsx b/apps/client/src/widgets/type_widgets/relation_map/RelationMap.tsxindex 8ecabacfe2..a13467d6fe 100644--- a/apps/client/src/widgets/type_widgets/relation_map/RelationMap.tsx+++ b/apps/client/src/widgets/type_widgets/relation_map/RelationMap.tsx@@ -211,7 +211,8 @@ async function useRelationData(noteId: string, mapData: MapData | undefined, mapconst [ inverseRelations, setInverseRelations ] = useState<RelationMapPostResponse["inverseRelations"]>();async function refresh() {- if (!noteIds) return;+ const api = mapApiRef.current;+ if (!noteIds || !api) return;const data = await server.post<RelationMapPostResponse>("relation-map", { noteIds, relationMapNoteId: noteId });const relations: ClientRelation[] = [];@@ -238,8 +239,8 @@ async function useRelationData(noteId: string, mapData: MapData | undefined, map}setRelations(relations);- mapApiRef.current?.loadRelations(relations);- mapApiRef.current?.cleanupOtherNotes(Object.keys(data.noteTitles));+ api.loadRelations(relations);+ api.cleanupOtherNotes(Object.keys(data.noteTitles));}useEffect(() => {