Skip to content

Commit 6acb58d

Browse files
authored
Fixed compatibility with React 18 strict effects (#1817)
1 parent d859c23 commit 6acb58d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/components/Provider.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export interface ProviderProps<A extends Action = AnyAction> {
2222
function Provider({ store, context, children }: ProviderProps) {
2323
const contextValue = useMemo(() => {
2424
const subscription = createSubscription(store)
25-
subscription.onStateChange = subscription.notifyNestedSubs
2625
return {
2726
store,
2827
subscription,
@@ -33,6 +32,7 @@ function Provider({ store, context, children }: ProviderProps) {
3332

3433
useIsomorphicLayoutEffect(() => {
3534
const { subscription } = contextValue
35+
subscription.onStateChange = subscription.notifyNestedSubs
3636
subscription.trySubscribe()
3737

3838
if (previousState !== store.getState()) {

0 commit comments

Comments
 (0)