-
Notifications
You must be signed in to change notification settings - Fork 791
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
Rehydration of prerendered page results in flashing of some components #2245
Comments
I'm also having this issue. Could be worth it to revisit this issue as well, as I believe they're related. |
@realityfilter I believe this issue is often caused by how the prerendered assets are served. If you're always serving the www/index.html, this is expected, as the first paint occurs before hydration, at which point the router/other dynamic components get to work. How are you serving your web pages? Are you by chance running a local |
Sorry for the late reply. The problem still exists with current stencil version 1.15.0. @harrysolovay I checked the static site files the following way:
So the correct html file for that specific page gets served and no fallback root index.html. The flickering is even visible when reloading the dev server. |
I'm also having this issue and I'm running the latest stencil |
Currently, the visibility hidden functionality works with either a class or an attribute. This is configured via the If possible, a great enhancement to stencil would be the ability to configure stencil to put these styles in your global CSS file. This would enable you to hide things prior to all the javascript running. As for the content in the style tag, it would be much better to use a hydratedFlag: {
selector: "attribute",
name: "hydrated",
property: "visibility",
initialValue: "hidden",
hydratedValue: "inherit",
output: "inline" | "global" // this is the new option that allows configuring where hydrated CSS lands
}, New option component-1:not([hydrated]), component-2:not([hydrated]) {
visibility: hidden
} |
My solution based on @realityfilter workaround to remove "hydrated" class from "html" tag: prerender.config.ts:
|
Although the above solution works. Its not very elegant to have to remove the class or attribute after it's already been added to the node. Some components could be visible until that code has been executed. It would be much more preferable if a component were able to not be automatically hydrated in the first place. Currently, every component is expected to have |
Hey there, thank you for the patience getting back to you. The new team is getting started and we're working through the backlog now. This should be addressed by PR #2989 once merged, allowing you to opt-out of the injected prehydrated style tag. |
The fix for this issue has landed in the main codebase and is a part of the Stencil v2.8 release. Thanks for you patience! |
Stencil version:
This affects also the current 1.8.x version of stencil.
I'm submitting a:
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://stencil-worldwide.herokuapp.com/ or https://forum.ionicframework.com/
Current behavior:
We prerender our site and have noticed flashing of parts of the site during rehydration.
For instance all
stencil-route-link
components toggle their visibility because of thehydrated class getting removed and added again. We tried the new feature of specifying a
hydratedFlag
ofnull
but this leads to even more flashing. One promising workaround is to remove thehydrated
class from the final prerendered html. No flashing. But the first initial paint is now slower because the site is now visible after all components are loaded and rehydrated.Expected behavior:
No flashing of components because of their visibility change during rehydration.
At least it would be nice to have an option for the prerender step to remove the hydrated flag from the final html output.
The text was updated successfully, but these errors were encountered: