Skip to content

Build your personal knowledge base with Trilium Notes

fix(note_detail): preview leaks between mermaid & SQL console

Elian Doran6972a4b9011f
diff --git a/apps/client/src/widgets/NoteDetail.tsx b/apps/client/src/widgets/NoteDetail.tsx
index ebce85a0cd..bb47dc80c1 100644
--- a/apps/client/src/widgets/NoteDetail.tsx
+++ b/apps/client/src/widgets/NoteDetail.tsx
@@ -265,9 +265,13 @@ function useNoteInfo() {
const [ note, setNote ] = useState<FNote | null | undefined>();
const [ type, setType ] = useState<ExtendedNoteType>();
const [ mime, setMime ] = useState<string>();
+ const refreshIdRef = useRef(0);
function refresh() {
+ const refreshId = ++refreshIdRef.current;
+
getExtendedWidgetType(actualNote, noteContext).then(type => {
+ if (refreshId !== refreshIdRef.current) return;
setNote(actualNote);
setType(type);
setMime(actualNote?.mime);