Hello, I’m experiencing some hydration issues when passing bound data to a custom component. Despite trying numerous solutions, I find myself quite lost on how to resolve this problem. Am I making a mistake, or has anyone else encountered a similar issue and found a solution? Any guidance would be greatly appreciated. You can check my repo, which is a basic NextJS project to reproduce the exact issue.
Builder content link
Builder public api key
9eacceea83e34c62b1ceadf2a0411f09
Detailed steps to reproduce the bug
See loom below
Thanks for including all that info. I have cloned your repository on my side and I was able to reproduce the issue. It seems like a bug, so we are discussing this with our internal team to find out a possible workaround. I will keep you updated on the progress of this issue.
We were able to reproduce the issue on our end, and it seems the hydration error is caused because you’re passing the builder content object. We are not sure why you are passing the content object; however, if you need to access the builder content data, you don’t need to pass it along with the builder component. Instead, you can use it from the builder context object in the editor. Here is an example:
context.builderContent.data.example
Additionally, we tested the scenario when passing an object that is used for binding in the editor. We did not encounter the same error, but you might need to use the useEffect hook for the parent component. Here is a modified code example:
I’ve duplicated this example block with hardcoded “myData” as in the example and pass that into my component and it still throws a hydration error. The prop value will be an empty string, then the value of “your text here a.”
This only works with Builder components, but if I try using a custom component with say a, “title” prop and bind the data, I get the hydration issue.
This is forcing me to have to hardcode all my product values or else I get a flash of my default string or a blank space before the data loads in.