widgetti / solara

A Pure Python, React-style Framework for Scaling Your Jupyter and Web Apps
https://solara.dev
MIT License
1.9k stars 141 forks source link

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

Open maartenbreddels opened 8 months ago

maartenbreddels commented 8 months ago

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 commented 8 months ago

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

SarthakNikhal commented 7 months ago

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

maartenbreddels commented 7 months ago

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:

Please also see https://solara.dev/documentation/advanced/development/setup

Regards,

Maarten