Skip to content

Build your personal knowledge base with Trilium Notes

chore(test): notify listeners with a loop

Elian Doranadea91160d72
diff --git a/apps/client/src/widgets/search_result.spec.tsx b/apps/client/src/widgets/search_result.spec.tsx
index 61d0b81579..665cec07bd 100644
--- a/apps/client/src/widgets/search_result.spec.tsx
+++ b/apps/client/src/widgets/search_result.spec.tsx
@@ -24,7 +24,11 @@ vi.mock("./react/hooks", async (importOriginal) => {
// Several components call this; notify them all, so the top-level widget re-renders too.
const listener = () => setNote(shownNote.current);
shownNote.listeners.add(listener);
- shownNote.notify = () => shownNote.listeners.forEach((notify) => notify());
+ shownNote.notify = () => {
+ for (const notify of shownNote.listeners) {
+ notify();
+ }
+ };
return () => {
shownNote.listeners.delete(listener);
};