scottrippey / next-router-mock

Mock implementation of the Next.js Router

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support Next 14.1 shallow routing

themagickoala opened this issue · comments

Next 14.1 introduced shallow routing to the App Router via window.history.pushState/replaceState (if you only change query string params). The Next App Router watches these calls and updates its internal state so that usePathname and useSearchParams update their return values. However, using this library, mockRouter.query does not update when calling these.

This may be something that isn't going to be supported by this library, given that it modifies browser APIs, but wanted to make sure it was known!