artalar / reatom

Reatom - the ultimate state manager
https://reatom.dev
MIT License
1.1k stars 110 forks source link

Add subpath parameter to withSearchParamsPersist #880

Closed artalar closed 1 week ago

artalar commented 5 months ago

Sometimes we need to persist a search parameter as the user moves through different URL paths.

An example. You have a search interface where the results could be presented in different forms, one of which is stored in a tab, and the tab is part of the URL path.

Another example, a pagination or other filters should be persisted when you go from a table page to an item page and want to go back via a breadcrumbs button.

To do this, I suggest adding a subpath parameter to the withSearchParamsPersist / searchParamsAtom.lens options, which takes a string of the allowed subpath for the persistence parameter. If a navigation occurs to the path starting with the passed subpath - the parameters will be persisted.

Jaishree2310 commented 4 months ago

Hey @artalar, can you please assign this issue to me? Thanks!!

artalar commented 4 months ago

@Jaishree2310 Sorry for the delay, here you go :) Ping me here if you need any help, I will check the notifications more often :)

artalar commented 4 months ago

@Jaishree2310 any news?

artalar commented 1 week ago

done