#Navigating back with different url search params does not refresh the page

2 messages · Page 1 of 1 (latest)

tacit meadow
#

I am using useRouter from next/navigation .

I am using it to navigate to the same route but with different search params e.g. /search?page=1, from this route, I navigate to /search?page=2 with router.push().

Some serverside components use the search param page to fetch their data, so when router.push is called, it 'refreshes' the page, and the serverside components fetch data with the correct page number.

However, when I navigate back with the browser to the previous route /search?page=1, the page does not refresh, and components are still using data from when router.push was last called

Is there a way to 'refresh' the page when navigating back?

#

Navigating back with different url search params does not refresh the page