Skip to content

Build your personal knowledge base with Trilium Notes

chore(react): fix events not updating properly

Elian Dorane89162838e48
diff --git a/apps/client/src/widgets/react/hooks.tsx b/apps/client/src/widgets/react/hooks.tsx
index b0fbacfa40..4e9a801df5 100644
--- a/apps/client/src/widgets/react/hooks.tsx
+++ b/apps/client/src/widgets/react/hooks.tsx
@@ -20,7 +20,7 @@ export function useTriliumEvent<T extends EventNames>(eventName: T, handler: (da
useEffect(() => {
parentComponent.registerHandler(eventName, handler);
return (() => parentComponent.removeHandler(eventName, handler));
- }, []);
+ }, [ eventName, handler ]);
useDebugValue(eventName);
}
@@ -44,7 +44,7 @@ export function useTriliumEvents<T extends EventNames>(eventNames: T[], handler:
parentComponent.removeHandler(eventName, callback);
}
});
- }, []);
+ }, [ eventNames, handler ]);
useDebugValue(() => eventNames.join(", "));
}