scottrippey / next-router-mock

Mock implementation of the Next.js Router
MIT License
401 stars 38 forks source link

Support Next 14.1 shallow routing #115

Open themagickoala opened 10 months ago

themagickoala commented 10 months ago

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!