From 122c84dd6052ea648f20bf5f3e2ae6604db3109d Mon Sep 17 00:00:00 2001 From: Will T Date: Sun, 18 Aug 2024 20:02:48 +0700 Subject: [PATCH] fix fromSelf always being truthy --- src/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 0718b8f..e003638 100644 --- a/src/index.ts +++ b/src/index.ts @@ -31,7 +31,9 @@ export function useZustand( () => [slice, store], ); useEffect(() => { - const unsubscribe = store.subscribe(rerender as DispatchWithoutAction); + const unsubscribe = store.subscribe(() => + (rerender as DispatchWithoutAction)(), + ); (rerender as DispatchWithoutAction)(); return unsubscribe; }, [store]);