Skip to content

Commit

Permalink
fix fromSelf always being truthy
Browse files Browse the repository at this point in the history
  • Loading branch information
itswillta committed Aug 19, 2024
1 parent e6a18ee commit 122c84d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ export function useZustand<State, Slice>(
() => [slice, store],
);
useEffect(() => {
const unsubscribe = store.subscribe(rerender as DispatchWithoutAction);
const unsubscribe = store.subscribe(() =>
(rerender as DispatchWithoutAction)(),
);
(rerender as DispatchWithoutAction)();
return unsubscribe;
}, [store]);
Expand Down

0 comments on commit 122c84d

Please sign in to comment.