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
Fixes component-renderer to allow for use of client-only-paths #1542
Fixes component-renderer to allow for use of client-only-paths #1542
Conversation
Deploy preview ready! Built with commit c323826 |
Deploy preview failed. Built with commit 8a4bde0 https://app.netlify.com/sites/using-styled-components/deploys/596e526e424ef25aaa0bf7a7 |
Deploy preview ready! Built with commit c323826 |
Deploy preview ready! Built with commit c323826 |
Nice! I liked how tightly scoped the fix is. Don't fix one thing and inadvertently break another (like I did for beta.6 ;-)) |
With a current (1.9.67) version of Gatsby I came upon non-working links to the client-only path in production build. I found this thread and discovered the following mismatch between the contents of this fix and the master, in the loader.js:
After I added that "page" member, links began to work. Maybe at some point it was overwritten with a "layout" by mistake? |
@skorowarkin someone else was mentioning that this was broken — could you submit a PR with the fix!? |
@KyleAMathews done: #2506 |
According to #1501, it looks like client-only-paths are broken in
1.0
. (It actually looks like this has been broken sincev1.0.0-beta.6
.)Looks like
componentShouldUpdate
assumes that, a route-change should only trigger a re-render if its accompanied by a corresponding change in the higher-levelpageResources.component
. In theory, this makes sense, though it's directly in conflict with the notion of client-only paths. My thought is that the re-render should be triggered if either the component changes OR the found page has a correspondingmatchPath
, (as demonstrated in the client-only-paths docs), in which case gatsby may not know whether or not a re-render is necessary and should optimistically trigger one.If there's a better way to go about this, great. 😎