mirror of
https://github.com/zadam/trilium.git
synced 2025-11-11 00:49:00 +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"]>();
|
const [ inverseRelations, setInverseRelations ] = useState<RelationMapPostResponse["inverseRelations"]>();
|
||||||
|
|
||||||
async function refresh() {
|
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 data = await server.post<RelationMapPostResponse>("relation-map", { noteIds, relationMapNoteId: noteId });
|
||||||
const relations: ClientRelation[] = [];
|
const relations: ClientRelation[] = [];
|
||||||
@ -238,8 +239,8 @@ async function useRelationData(noteId: string, mapData: MapData | undefined, map
|
|||||||
}
|
}
|
||||||
|
|
||||||
setRelations(relations);
|
setRelations(relations);
|
||||||
mapApiRef.current?.loadRelations(relations);
|
api.loadRelations(relations);
|
||||||
mapApiRef.current?.cleanupOtherNotes(Object.keys(data.noteTitles));
|
api.cleanupOtherNotes(Object.keys(data.noteTitles));
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user