mirror of
https://github.com/zadam/trilium.git
synced 2025-11-10 16:39:02 +01:00
fix(type_widgets/relation_map): map emptied when switching fast
This commit is contained in:
parent
33a41d2f86
commit
d4194c503c
@ -211,7 +211,8 @@ async function useRelationData(noteId: string, mapData: MapData | undefined, map
|
||||
const [ 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(() => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user