-
Notifications
You must be signed in to change notification settings - Fork 37
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
using <StoryblokComponent /> in a client Component ("use client") #1161
Comments
I do have the same problem. |
Hi @kingmauri @negprof a question for you: are you following the guide on the README and specifically this part https://github.com/storyblok/storyblok-react?tab=readme-ov-file#nextjs-using-app-router---live-editing-support ? |
Hello @edodusi ! I have implemented both approaches in my project, and I manage them using a staging instance for Next.js with:
and a production instance with:
My code works with the Edit: I found out that the hydration error is gone when wrapping the "use client" component with:
Edit 2: The whole problem solves when using storyblokInit inside the "use client" component. In my case:
The question is, what would be the correct way to handle this for multiply components? This way, the layout.jsx is still full rsc, but only the "slider section" is rendered on the client. |
@negprof can I ask you to try the package at this PR? #1201 You can install it with this command for example
In the PR description you can also find some instructions, be sure to also check the changed README here https://github.com/storyblok/storyblok-react/pull/1201/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5 It should be easy to integrate but let me know if you find some hiccups. I want to see if the problem that you have is related to our current implementation, that we are fixing in the mentioned PR, or some error on your side. Thank you note: you should not call |
Hey @edodusi, thank you for your time. I reviewed your PR and was wondering if the proposed solution fully addresses my issue. With your approach, we still have "use client" wrapping the entire project, which prevents us from taking full advantage of SSR because the client moduletree will be bigger. Ideally, I'd prefer to use "use client" only within a specific component. In my case I dont´t need liveediting for the production instance, but I need a answer how to render with inside a "use client" component. Maybe there need to be something like a mapper function for the client in this case. Any suggestions? |
@negprof with this solution your root component is not |
thanks for your informations @edodusi |
hey @kingmauri were you able to solve this issue? |
Describe the issue you're facing
I'm using Next with AppRouter.
I'm not sure if this is a bug or if I've implemented something incorrectly. As soon as I use the StoryblokComponent in a client component, the log tells me that the respective component cannot be found (as if it was not registered). As soon as I remove "use client", it works. Is this a known bug, or am I misunderstanding something? Thank you very much.
Reproduction
Steps to reproduce
No response
System Info
Used Package Manager
npm
Error logs (Optional)
No response
Validations
The text was updated successfully, but these errors were encountered: