-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
pathPrefix and SSR@runtime does not work together #35406
Comments
Not only SSR but DSR too. |
Please show any sign that the bug is being validated or something. We really need to use path prefixed links with gatsby serve! |
I need too |
3 months, 3! |
I think I summon my coworkers to weigh in on this bug because that's ridiculous. |
Confirmed, will be opening PR with fixes and some tests soon |
Hi @jbebe and @rogeriocolonna, we published the fix to |
Yes, is working fine! |
Thank you!
Em seg., 25 de jul. de 2022 às 23:24, Ty Hopp ***@***.***>
escreveu:
… Hi @jbebe <https://github.com/jbebe> and @rogeriocolonna
<https://github.com/rogeriocolonna>, we published the fix to
***@***.*** Please try it out if you can, hopefully this will
unblock you both. This will land in the next minor release ***@***.***)
on August 2nd.
—
Reply to this email directly, view it on GitHub
<#35406 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA3WEOK2YXHNKTNNVVOIXNDVV5D7RANCNFSM5TGCKCWQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Preliminary Checks
Description
When using the Gatsby v4 SSR@R feature of
gatsby serve
the usage of pathPrefix makes the runtime fail to prefetch urls.In
packages/gatsby/cache-dir/loader.js
there's a line:This
findPath
call removes the path prefix frompagePath
, doPrefetch gets an invalid url and this corrupts the runtime cache, so if I click on any link, the framework loads up the 404 page.This - of course - only happens if doPrefetch is called. If I use
<a>
tags in my components instead of<Link>
, then the problem goes away, and also the SPA feature of Gatbsy... 😄Since pathPrefix cleaning is part of findPath for a very long time (around 4 years?) I think the issue here is that someone didn't think about how SSR@R and pathPrefix trimming plays along.
Reproduction Link
https://github.com/jbebe/gatsby-prefetch-issue-repro
Steps to Reproduce
Steps to Reproduce:
<Link>
tag on the index.tsx page that references /any-random-urlSteps to get rid of the bug: (pick any and it will work)
<a href="withPrefix(...)">
instead of<Link to={...}>
Expected Result
SSR@R components/urls with pathPrefix should work like simple, pre-generated content with pathPrefix.
Actual Result
Prefetch handles SSR@R urls differently, it strips the prefix from the url, so it won't point to anywhere.
Environment
Config Flags
pathPrefix: '/blog'
--prefix-paths
The text was updated successfully, but these errors were encountered: