solara
solara copied to clipboard
Add .query (query string) to router and deprecate .search
According to https://developer.mozilla.org/en-US/docs/Web/API/Location the .search includes the ? which Solara does not. If we change this, it will be a breaking change because people may already depend on this behaviour.
I suggest we keep .search
but remove it from the docs (soft deprecation / or maybe include a deprecation warning?)
Next, we add .query
, which should be the valid one, without the '?'
Should also improve findability of the search property in the documentation (#469)
@maartenbreddels Can I work on this issue? Let me know how .query should be different than .search
Hi @SarthakNikhal ,
yes, you are more than welcome.
I think for a URL like http://localhost:8765/?a=1&b=2 we should have have router.query == 'a=1&b=2'
.
The current .search
should have been router.search == '?a=1&b=2'
, but we do not want to break that current behaviour.
So I suggest the following:
- add .query in the router, and document it
- turn .search into a property, which will give a deprecation warning explaining the above inconsistency, and telling people to use .query instead.
Please also see https://solara.dev/documentation/advanced/development/setup
Regards,
Maarten