Ability to setSearchParams without navigation in useSearchParams #7966
KevinVandy
started this conversation in
Proposals
Replies: 1 comment
-
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. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
It appears that the current intended functionality of the
useSearchParams
setSearchParams
function is to always cause a navigation and trigger loaders wheneversetSearchParams
is called. I think it would be useful to be able to prevent a navigation and loaders being triggered. Perhaps anavigate
ornavigation
boolean 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.Beta Was this translation helpful? Give feedback.
All reactions