The problem:
when attempting shallow routing with changing (adding or removing NOT updating) the query string in Next.js the page is reloaded and the shallow ignored.
How can I prevent reloading while changing the query string?
Example:
from: example.com/page1/?a=2
to: example.com/page1/?a=2&b=3
Code:
const newSearch = '?a=2&b=3'
router.push(`/page1/${newSearch}`, null, { shallow: true })
I also try:
const newSearch = '?a=2&b=3'
router.push(`/page1/${newSearch}`, `/page1/${newSearch}`, { shallow: true })