Shallow routing not working with `useRouter.push` from `next/navigation`
Unanswered
jaggi73 posted this in #help-forum
jaggi73OP
I am using
push method of the useRouter hook imported from next/navigation with config passed as {shallow: true} and only changing the query params. However, it is still making server calls (the API call on the page.tsx is running again) on change of the query params. How can I change the query params without making any server calls4 Replies
jaggi73OP
Something equivalent to
push(route, undefined, {shallow: true}) from the pages directoryjaggi73OP
Any help please?
Still havent been able to figure this out
Still havent been able to figure this out
jaggi73OP
Using
window.history.pushState(
{},
"",
window.location.pathname + queryString
); for nowSun bear
There is no
The only property push function can take as a second parameter is
See more: https://nextjs.org/docs/app/api-reference/functions/use-router#userouter
{shallow: boolean} property for the newer version of useRouter from next/navigation.The only property push function can take as a second parameter is
{scroll: boolean}.See more: https://nextjs.org/docs/app/api-reference/functions/use-router#userouter