fix(layout/formatting_toolbar): memory leak for closed tabs

This commit is contained in:
Elian Doran 2025-12-13 16:31:19 +02:00
parent 4182f6043a
commit 476c162016
No known key found for this signature in database

View File

@ -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;