Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a debug check to <Provider> to throw a more detailed error when used in Next #2082

Open
markerikson opened this issue Nov 11, 2023 · 7 comments
Milestone

Comments

@markerikson
Copy link
Contributor

markerikson commented Nov 11, 2023

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

@markerikson markerikson added this to the 9.0 milestone Nov 11, 2023
@phryneas
Copy link
Member

image

v9 already handles this.

@markerikson
Copy link
Contributor Author

Still worth doing something for v8, especially since it doesn't have the "react-server" condition available?

@phryneas
Copy link
Member

Totally up to you 😊

@ryota-murakami
Copy link

How about adding use client on the top of file?

@EskiMojo14
Copy link
Collaborator

@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

@ryota-murakami
Copy link

@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.

@EskiMojo14
Copy link
Collaborator

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants