<g-link> doesn't actually change pages on build - Hydration issue
See original GitHub issueDescription
<g-link> updates the page title (in the browser tabs) and loads things like the console log but it does not change what I see on the page without reloading. In gridsome develop
this is not an issue but gridsome build
it fails.
I’m assuming I might have invalid HTML somewhere, but perhaps it could be something else, any suggestions?
I’ve looked at a lot of other similar g-link issues like https://github.com/gridsome/gridsome/issues/337 but to no prevail.
Steps to reproduce
https://github.com/element-softworks/atobtyres
Expected result
<g-link>
should hydrate the pages without having to reload the page manually
Actual result
The page does visually not change unless I reload the page, I do think the code is loaded, just the view doesn’t seem to change.
Environment
Libs:
- gridsome version: 0.6.6
- @gridsome/cli version: 0.2.0
Browser:
- [x] Chrome (desktop) version
- [x] Chrome (iOS) version
- [x] Safari (desktop) version
For Tooling issues:
- Node version: 10.13
- Platform: Mac
Issue Analytics
- State:
- Created 4 years ago
- Reactions:8
- Comments:58 (7 by maintainers)
Top Results From Across the Web
Debugging and fixing hydration issues - somewhat abstract
Spotting hydration errors and fixing them can prevent serious user-facing performance issues, and since we do not get a signal during production ...
Read more >What to do when home seller lies on seller disclosure forms
This issue was never mentioned by our seller in the seller disclosure statement. We did ask the seller about water leaks in the...
Read more >Why does NextJS give this hydration error on dev server build ...
If you use create-next-app and paste this code, ... pages/index.js ... This hydration error in my example doesn't appear to be an issue...
Read more >Municipal Annexation Handbook - Ancel Glink
Increasingly, residential and even commercial landowners may have been unwilling to annex to a nearby municipality are re-thinking those issues. In this era...
Read more >Buyer's Responsibility To Change Utilities After Closing
The heat, electricity and water were on as well. Sellers Turned Off Utilities After Closing Without Informing Buyers. When we closed on the ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve added another minimalistic repository to reproduce the failure with valid routes.
You can see that once you change the HTML from
to
the page loads successfully again. It looks like gridsome is trying to access child nodes of the page which do not exist (my assumption is based on the fact that I saw
Uncaught (in promise) DOMException: Failed to execute 'appendChild' on 'Node': This node type does not support this method
on my production site).For both sample repos no error message is shown and they work flawlessly in
develop
mode.Generally I’ve seen (and read about) hydration issues pop up around:
<p><Component /></p>
or<p><Component><p><template name="test"></p></Component></p>
where the component wraps its slot around<p>
already (nested paragraphs are not allowed))v-html
to dynamically parse HTML:<p v-html="var" />
wherevar = <p>Text</p>
(nested paragraphs are not allowed)<g-link>
data-netlify="true"
in formsbeforeMount
<g-link>
as root component of a page<g-link>
without a trailing slash<div> </div>
instead of<div class="..."></div>
<!-- <Social /> -->
as this will show up as<!---->
and cause aappendChild()
exception<transition>
tags generate<span>
which may not have<div>
as children - use<transition tag='div'>
<g-link>
lead to valid pathsdata()
method or one returning nothing instead ofreturn {}
metaInfo: {return{}}
instead ofmetaInfo() {return{}}
)Two options I think could be acceptable would be that it breaks during development in the same way it breaks during production build. Or it at least gives a console warning if there’s invalid HTML. I mean, ideally a developer knows how to avoid invalid HTML, but machines are way better than humans at that.