Open srapport opened 2 months ago
let me take a look
Do you have any ideas about this bug? @wmertens
q-data.json
is real-time when you run npm run dev
but q-data.json
was built to be a bundle in PRO,
@JerryWu1234 I think the problem here is that q-data.json is read from the filesystem even when a query string is provided. It should only use exact matches to do this, and fall back to the server
@JerryWu1234 I think the problem here is that q-data.json is read from the filesystem even when a query string is provided. It should only use exact matches to do this, and fall back to the server
you mean that doesn't generate a q-data.json
file when run pnpm run build
。 right?
it gets the content of q-data.json
from server
hmm no, q-data is generated by SSG too. The problem is that it is only valid without the query string and should not be served if a query is present
@srapport the problem is that serve strips the query string and then serves q-data.json which was generated for the page without the query string.
However, when building a static site, there is no server to ask q-data from, so falling back to a file without query string is reasonable. However, when you do so, the query string is a lie, because the q-data was generated without the query string. In that case, Qwik should remove it from the browser's URL.
So, there's two cases for SSG:
In case 1, I believe everything works as it should. In case 2, I also believe everything works as it should, except that currently there's no way to generate SSG pages with query strings. I'm looking at adding that.
Thank you @wmertens. So long as we provide a way to get the query string, all is good. Otherwise in a static hybrid mobile context such as Cordova or Capacitor, there is no way to stitch it back together without patching fetch.
Which component is affected?
Qwik City (routing)
Describe the bug
Route loader logic is dropping query params on static builds, but is working correctly on SSR builds. It is necessary to return the query string consistently in both SSR and Static builds to support hybrid mobile apps. This was working but broke in a recent qwik release.
Reproduction
https://github.com/srapport/qwik-static-route-loader-issue
Steps to reproduce
using the sample repo:
Hover over the link on the home page and inspect the network results. The query string is dropped.
Now, compare this to an SSR execution:
Hover over the link on the home page and inspect the network results. The query string is preserved.
System Info
Additional Information
@shairez, following up on our conversation.
Cc: @KenAKAFrosty @wmertens @mhevery