Skip to content

Fetch data when query params change? #468

Closed Answered by franky47
tar-aldev asked this question in Q&A
Discussion options

You must be logged in to vote

I wouldn't recommend depending on subscribeToQueryUpdates, it's marked as deprecated and will be removed in v2 which will be released early February.

url is reset

What version of Next.js and nuqs are you using ? Please refer to the compatibility table, there have been known cases where nuqs' shallow updates would be reset by the Next.js router.

One last tip: you can await the setState to know when the URL is up to date, and trigger your client-side fetch there, if it makes sense. The awaited result is a URLSearchParams object of the location.search that was applied.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@tar-aldev
Comment options

Answer selected by franky47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants