diff --git a/src/components/Provider.tsx b/src/components/Provider.tsx index cb22b55bf..a85bb7fd6 100644 --- a/src/components/Provider.tsx +++ b/src/components/Provider.tsx @@ -22,7 +22,6 @@ export interface ProviderProps { function Provider({ store, context, children }: ProviderProps) { const contextValue = useMemo(() => { const subscription = createSubscription(store) - subscription.onStateChange = subscription.notifyNestedSubs return { store, subscription, @@ -33,6 +32,7 @@ function Provider({ store, context, children }: ProviderProps) { useIsomorphicLayoutEffect(() => { const { subscription } = contextValue + subscription.onStateChange = subscription.notifyNestedSubs subscription.trySubscribe() if (previousState !== store.getState()) {