solara icon indicating copy to clipboard operation
solara copied to clipboard

Add .query (query string) to router and deprecate .search

Open maartenbreddels opened this issue 1 year ago • 3 comments

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 '?'

maartenbreddels avatar Feb 26 '24 15:02 maartenbreddels

Should also improve findability of the search property in the documentation (#469)

maartenbreddels avatar Feb 28 '24 08:02 maartenbreddels

@maartenbreddels Can I work on this issue? Let me know how .query should be different than .search

SarthakNikhal avatar Apr 18 '24 15:04 SarthakNikhal

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

maartenbreddels avatar Apr 19 '24 11:04 maartenbreddels