Skip to content

Commit

Permalink
fix(next/router): Prevent query delete in routing when next.config ba…
Browse files Browse the repository at this point in the history
…sePath option is true
  • Loading branch information
flex-kyunghwa committed Sep 15, 2022
1 parent 7477fcd commit 37c3104
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/next/shared/lib/router/router.ts
Expand Up @@ -1552,7 +1552,11 @@ export default class Router implements BaseRouter {
query = Object.assign({}, routeInfo.query || {}, query)
}

if (routeMatch && pathname !== parsed.pathname) {
const cleanedParsedPathname = hasBasePath(parsed.pathname)
? removeBasePath(parsed.pathname)
: parsed.pathname

if (routeMatch && pathname !== cleanedParsedPathname) {
Object.keys(routeMatch).forEach((key) => {
if (routeMatch && query[key] === routeMatch[key]) {
delete query[key]
Expand Down

0 comments on commit 37c3104

Please sign in to comment.