mirror of
https://github.com/zadam/trilium.git
synced 2026-02-12 01:16:59 +01:00
fix(layout/formatting_toolbar): memory leak for closed tabs
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user