T
TanStack5mo ago
foreign-sapphire

Resetting search parameters when leaving a location / route?

I'm using search parameters for pagination vales like page and offset. When navigating away from a route with a table that uses these, to a different route that also has a table that uses page and offset, I want those values to be reset. Is there some way to solve this in the route setup (ie with onLeave), or do I have to do what I do now, setting these search paramaters to 0 on every mavigate/link in the page?
2 Replies
harsh-harlequin
harsh-harlequin5mo ago
what do you mean by "reset"? ideally share a complete minimal example
passive-yellow
passive-yellow5mo ago
@MarkusAugust as soon you navigate away the search params are re-setted. If you navigate on the same page with navigate({to:".", search: {}}) then you have to use the logic you want it to be. For example if you do a search and you were already on page: 3 then you should manually on search input reset that page back to 0

Did you find this page helpful?