qwik
qwik copied to clipboard
The useLocation().query object values should return string or Array<string>
trafficstars
Qwik Version
qwik 0.11.0, qwik city 0.0.112
Operating System (or Browser)
chrome
Node Version (if applicable)
16.14.2
Which component is affected?
Qwik City
Expected Behaviour
The url example.com?brand=amd&brand=intel&category=cpu contains two "brand" query params and one "category" query param.
useLocation().query should return { brand: ['amd', 'intel'], category: 'cpu' }
Actual Behaviour
useLocation().query returns { brand: 'intel', category: 'cpu' }, only returning the last "brand" query param.
Additional Information
demo https://stackblitz.com/edit/qwik-starter-7bcp3c?a=1&file=src%2Froutes%2Findex.tsx
The query object is now a URLSearchParams as of https://github.com/BuilderIO/qwik/pull/2385
Thanks for opening the issue!