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(layout/formatting_toolbar): memory leak for closed tabs
Elian Doran476c1620163b
diff --git a/apps/client/src/widgets/ribbon/FormattingToolbar.tsx b/apps/client/src/widgets/ribbon/FormattingToolbar.tsxindex c1e7d103ff..c8d32aab77 100644--- a/apps/client/src/widgets/ribbon/FormattingToolbar.tsx+++ b/apps/client/src/widgets/ribbon/FormattingToolbar.tsx@@ -64,6 +64,13 @@ export function FixedFormattingToolbar() {}});+ // Clean the cache when tabs are closed.+ useTriliumEvent("noteContextRemoved", ({ ntxIds: eventNtxIds }) => {+ for (const eventNtxId of eventNtxIds) {+ toolbarCache.delete(eventNtxId);+ }+ });+// Switch between the cached toolbar when user navigates to a different note context.useEffect(() => {if (!ntxId) return;