diff --git a/apps/client/src/widgets/ribbon/FormattingToolbar.tsx b/apps/client/src/widgets/ribbon/FormattingToolbar.tsx index c1e7d103f..c8d32aab7 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;