Closed pejeio closed 6 months ago
Can you provide a reproduction?
Can you provide a reproduction?
Sure! There you go: https://codesandbox.io/p/devbox/brave-https-dvd3vk?file=%2Fsrc%2Froutes%2F%2Bpage.svelte%3A9%2C1
Ok the problem is simply that if the query param is not present the value of the store will be null. To fix this you can use the default value for the encoder/decoder
const selected = queryParam('years', ssp.array([]));
Thanks @paoloricciuti! Much appreciated. Quick question: Whenever I do this, the ?years
search parameter gets appended to the URL, even if no checkboxes are chosen. Any idea how to conceal it when no checkboxes are chosen?
Thanks @paoloricciuti! Much appreciated. Quick question: Whenever I do this, the
?years
search parameter gets appended to the URL, even if no checkboxes are chosen. Any idea how to conceal it when no checkboxes are chosen?
Yes you can do set showDefaults
to false
https://github.com/paoloricciuti/sveltekit-search-params?tab=readme-ov-file#showdefaults
Describe the problem
In Svelte, you can use the
bind:group
feature like so:However, when attempting to apply the same technique with the (awesome! 😎)
sveltekit-search-params
package, as shown:An error occurs:
Describe the proposed solution
It's possible that there's an error in my implementation, or perhaps this feature isn't supported yet. Regardless, having this functionality would be fantastic.