Ability to setSearchParams without navigation in useSearchParams #7966
Closed
KevinVandy
started this conversation in
Proposals
Replies: 3 comments
|
Completely agree. Example would be infinite scrolling with current page update in url. So that when user refresh a page via F5 or share a link, actual page parameter would be in url. Sending any server-side rendering requests not required for that. |
0 replies
|
this is a pain, how is this not solved? |
0 replies
|
This discussion is being closed as part of the Remix v3 repository cleanup. Remix v1/v2 was upstreamed into React Router v7, so if this proposal is still relevant, please reopen or continue the discussion in the React Router repository. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
It appears that the current intended functionality of the
useSearchParamssetSearchParamsfunction is to always cause a navigation and trigger loaders wheneversetSearchParamsis called. I think it would be useful to be able to prevent a navigation and loaders being triggered. Perhaps anavigateornavigationboolean option.For example, here is what I was hoping I could write:
I am, of course, able to achieve this today by following a pattern like this. The main reason for using search params state was to grab the initial state, but I don't need any of the route or root loaders to reload whenever this value changes in the URL.
Maybe this isn't the intended use case for
useSearchParams, but I think programmatically being able to control whether or not a navigation is needed upon a URL state change would be convenient.All reactions