react-redux
react-redux copied to clipboard
Add a debug check to `<Provider>` to throw a more detailed error when used in Next
- Ref: https://github.com/reduxjs/redux-toolkit/issues/3842 and many others
I wonder if we could somehow do a debug check inside of <Provider>
, check for the existence of useIsomorphicLayoutEffect
, and throw a more informative error if it doesn't exist?
I know we added the "react-server"
condition in v9 beta - not sure how these play together
v9 already handles this.
Still worth doing something for v8, especially since it doesn't have the "react-server"
condition available?
Totally up to you 😊
How about adding use client
on the top of <Provider /> file?
@ryota-murakami the props Provider needs (store, context) aren't serializeable, so it would still need to be called from a client component as far as i know
@EskiMojo14 I think that's right too. I just felt that if I had explicitly stated Client Compoment, Next would have given a friendly error message. My memory is a bit fuzzy around here, sorry.
@ryota-murakami no worries - my suspicion is that with the "use client" pragma added, it would throw an error message relating to store.dispatch not being serializeable instead of hooks not existing
neither is ideal which is why it'd be good to have an explicit check so we can control the error message