router.push is too slow
Unanswered
White-horned horntail posted this in #help-forum
White-horned horntailOP
In my application I have a couple of filters for jobs list which triggers change of search params to update content. We migrated from Next 12 and in previous version we used { shallow: true } but it looks like new router doesn't have this option.
I tried to reproduce the behaviour with window.history.pushState but the problem that when I try to get new values from useSearchParams() they are not update.
Any ways to make router.push faster or somehow implement shallow routing correctly?
I tried to reproduce the behaviour with window.history.pushState but the problem that when I try to get new values from useSearchParams() they are not update.
Any ways to make router.push faster or somehow implement shallow routing correctly?
2 Replies
either I'm being dumb but I still can see from the docs that you can do 'router.push('/?counter=10', undefined, { shallow: true })' sorry If I'm miss leading you EDIT: I'm being dumb indeed I'm reading the pages router and I guess you were refering to the app router EDIT2: https://medium.com/@moh.mir36/shallow-routing-with-next-js-v13-app-directory-2d765928c340 may be helpful to you