paoloricciuti / sveltekit-search-params

The easiest way to read and WRITE from query parameters in sveltekit.
https://sveltekit-search-params.netlify.app
MIT License
497 stars 15 forks source link

URL #hash being removed on update #15

Closed devinellis closed 1 year ago

devinellis commented 1 year ago

Describe the bug

Hi, I am excited to use your plugin as it does everything I need to maintain state using query params, thank you for developing it!

I noticed that when I update a queryParam, it seems to remove the #hash portion of the URL. I assume this is not intentional?

As you can see in my reproduction steps below, I am using maplibre-gl which maintains its map state in the URL hash automatically, so I'd like to leave it untouched.

Reproduction

// Current URL: http://localhost/#10/29.42/-98.47
const search = queryParam('q', ssp.string());
$search = 'foo';
// New URL: http://localhost/?q=foo

Logs

No response

paoloricciuti commented 1 year ago

Make sense to me...I'll ship a fix tomorrow morning, thanks for reporting. 👍

paoloricciuti commented 1 year ago

This should be fixed in 1.0.7 let me know if that's ok and thanks again for reporting

devinellis commented 1 year ago

@paoloricciuti Did you forget to create a release? Or are you still working on other changes to include in 1.0.7? Thanks

paoloricciuti commented 1 year ago

@paoloricciuti Did you forget to create a release? Or are you still working on other changes to include in 1.0.7? Thanks

Sorry I included changesets in the project so that I didn't need to create a release to publish on npm and I forgot to create the actual release announcement. However the package is updated on npm and you can already install it

https://www.npmjs.com/package/sveltekit-search-params

devinellis commented 1 year ago

I updated my package.json and re-installed, and my app is still removing the url hash. I tried a default queryParam, and one set to pushHistory:false. Is there anything specific you'd like me to test?

paoloricciuti commented 1 year ago

uhm it's seems like it had some problem publishing and it published the old version with the new version number.

I will republish as soon as I can and hit you up here

paoloricciuti commented 1 year ago

@devinellis you can try with 1.0.9

devinellis commented 1 year ago

~I tried 1.0.9 and it's still getting stripped.~

~FWIW, before using SSP, I was calling history.pushState() and the hashtag was not stripped out. So I don't think its something else in my app causing the problem.~

devinellis commented 1 year ago

@paoloricciuti it works in 1.0.10! Thanks!

paoloricciuti commented 1 year ago

@paoloricciuti it works in 1.0.10! Thanks!

Well that's strange given I didn't change literally anything between 1.0.9 and 1.0.10 but I guess we don't care lol