mirror of
https://github.com/zadam/trilium.git
synced 2025-12-17 21:04:24 +01:00
fix(layout/formatting_toolbar): memory leak for closed tabs
This commit is contained in:
parent
4182f6043a
commit
476c162016
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user