Skip to content

Commit

Permalink
fix(useStores): fix subscribe's default reactivity
Browse files Browse the repository at this point in the history
  • Loading branch information
afiiif committed Oct 5, 2023
1 parent 3e45605 commit ad17850
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/react/create-stores.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,11 @@ export const createStores = <TKey extends StoreKey = StoreKey, T extends StoreDa
});
};

useStores.subscribe = (key: Maybe<TKey>, fn: (state: T) => void, selectDeps?: SelectDeps<T>) => {
useStores.subscribe = (
key: Maybe<TKey>,
fn: (state: T) => void,
selectDeps: SelectDeps<T> = defaultDeps,
) => {
const store = getStore(key);
return store.subscribe(fn, selectDeps);
};
Expand Down

0 comments on commit ad17850

Please sign in to comment.