-
Notifications
You must be signed in to change notification settings - Fork 135
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
Bug: ServerSide Rendered Content is sometimes absent from the __NEXT_DATA__ hydration #624
Comments
Thought I'd try digging more into this and found a couple things out. We had discussed that there was potentially an issue with $on inside of an imported component and that maybe by trying to access the $on value inside of a page component may cause the server-side rendering to function as intended. Unfortunately it produces the same results (still inconsistently). I then tried calling one of our gutenberg block's fields directly in the page component, in this instance a simple WYSIWYG field on an Intro Paragraph ACF block. After a few reloads I was able to get the page to load without any data like it had been but the Intro Paragraph's WYSIWYG field did load server-side. |
Thanks for reporting this @jsimondshiebing. I am seeing some inconsistencies with SSG and the |
I was able to reproduce this and have a minimal repo demonstrating the issue: https://github.com/blakewilson/gqty-on-ssg-next-issue/ It seems to be related to GQty, I've opened an issue here: gqty-dev/gqty/issues/276 |
Thanks Blake! I let our team know the status of this and will continue to monitor this issue as well as the GQty one. Thanks for setting up the repo too as a demo, if you need anything else just let me know. |
This issue is actually related to having a conditional within a conditional. This is not supported by GQty. Instead, the selections have to be made before doing anything conditional with the data. For an example, say you have a blocks.map((block, index) => {
switch (block.name) {
case "core/paragraph": {
return (
<div
key={index}
dangerouslySetInnerHTML={{
__html: block?.$on.CoreParagraphBlock?.originalContent,
}}
/>
);
}
}
}); In this instance, the blocks.map((block, index) => {
const coreParagraphBlockContent =
block?.$on.CoreParagraphBlock?.originalContent;
switch (block.name) {
case "core/paragraph": {
return (
<div
key={index}
dangerouslySetInnerHTML={{
__html: coreParagraphBlockContent,
}}
/>
);
}
}
}); Alternatively, GQty has the |
More context: gqty-dev/gqty#290 (comment) |
@blakewilson we have made some updates to our code to match the structure above where fields are being specified outside our conditional block switch statement. Since doing that we are able to see content load in server-side consistently so that's a good sign. However it looks as though we have an issue where it's re-rendering the whole page multiple times, header and footer as well which are not handled in the switch statement conditionals, on initial load for some reason causing a flickering effect. We also tried using the prepass helper function but haven't seen a drastic difference in behavior from moving fields outside conditionals. |
Hey @jsimondshiebing, awesome! I'm glad that worked. For the flickering related issue, that sounds more like a rogue |
Hey @jsimondshiebing, wanted to follow up to see if you were able to diagnose this? |
Hey @jsimondshiebing, it looks like the original issue here has been resolved, so I'll close this for now. If you experience any other problems though, please feel free to open a new issue |
When loading static pages server-side the initial data returned from GQTY requests that utilize the $on notation do not return consistently. There are times where data will be visible from the source as well as in the NEXT_DATA pageProps object, however for the most part blocks return with just the __typename and name properties.
Applicable Versions
@faustjs/core
version: 0.12.4@faustjs/next
version: 0.13.0The text was updated successfully, but these errors were encountered: