qwik
qwik copied to clipboard
[🐞] Use location params does not exist
Which component is affected?
Qwik City (routing)
Describe the bug
With the current https://qwik.new/ template, open the flower example and see this error:
37 | class={{
38 | host: true,
39 | pride: loc.query.get('pride') === 'true',
| ^
40 | }}
41 | >
Reproduction
https://stackblitz.com/edit/qwik-starter?file=src%2Froutes%2Fdemo%2Fflower%2Findex.tsx
Steps to reproduce
No response
System Info
1. Open demo
2. Click on the `Flower App` link
Additional Information
Seems that the useLocation is missing the query when it should appear there, I haven't look at the source yet.
It might have changed at some point, but loc.url.searchParams.get('pride')
is what would work with the latest Qwik I think.
This seems to have been fixed in the current version.
I am having the same issue with SSG using qwik v1.2.7. I have a page at /order/view/?id=7
, when I use a Link
to navigate to that page then loc.url.searchParams.get('id')
will correctly return '7' but when I reload/refresh the page or directly navigate to the page then it will return a null. Currently I am using this to solve the issue: new URL(document.URL).searchParams.get('id')
.
This issue does not appear on pnpm dev
mode, it works correctly. It appears only in SSG using pnpm build
then serve the dist folder using nginx.
@adamgen is it still an issue?
@lbensaad can you please open up a new issue with we repo showing your specific issue?
The demo works fine; I'm closing it. 👍🏼