Skip to content

Build your personal knowledge base with Trilium Notes

Update apps/client/src/widgets/collections/NoteList.tsx

Elian Doranb47c938dbe98
diff --git a/apps/client/src/widgets/collections/NoteList.tsx b/apps/client/src/widgets/collections/NoteList.tsx
index 5de699b83e..6bac9b0851 100644
--- a/apps/client/src/widgets/collections/NoteList.tsx
+++ b/apps/client/src/widgets/collections/NoteList.tsx
@@ -130,8 +130,11 @@ export function CustomNoteList({ note, viewType, isEnabled: shouldEnable, conten
// there seems to be a race condition on Firefox which triggers the observer only before the widget is visible
// (intersection is false). https://github.com/zadam/trilium/issues/4165
- setTimeout(() => widgetRef.current && observer.observe(widgetRef.current), 10);
- return () => observer.disconnect();
+ const observeTimeout = setTimeout(() => widgetRef.current && observer.observe(widgetRef.current), 10);
+ return () => {
+ clearTimeout(observeTimeout);
+ observer.disconnect();
+ };
}, [ widgetRef, isFullHeight, displayOnlyCollections, note, contentReady ]);
// Preload the configuration.