-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix navigation issue when dynamic param casing changes (#61726)
### What When navigating to a page with dynamic params using a certain casing, and then following a link to another page using _different_ casing for the same param, the router would get stuck in an infinite suspense cycle. ### Why On the client we normalize cache keys by lowercasing the values for dynamic segments. However the RSC data for each segment wouldn't have this same casing logic applied. This is causing the router to not recognize that there is already RSC data available for that segment, resulting in an infinite suspense cycle. ### How The `toLowerCase()` logic shouldn't be needed here. Technically we could leave this in place and update `matchSegment` to also apply the lowercase logic, but currently there are too many utility functions that parse segments to comfortably make that change. I confirmed that the bug related to why we lowercased these router cache keys is no longer present after making this change. Fixes #61722 Closes NEXT-2377
- Loading branch information
Showing
6 changed files
with
65 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
test/e2e/app-dir/navigation/app/dynamic-param-casing-change/[paramA]/[paramB]/page.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function Page() { | ||
return <div>[paramB] page</div> | ||
} |
3 changes: 3 additions & 0 deletions
3
test/e2e/app-dir/navigation/app/dynamic-param-casing-change/[paramA]/noParam/page.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function Page() { | ||
return <div>noParam page</div> | ||
} |
18 changes: 18 additions & 0 deletions
18
test/e2e/app-dir/navigation/app/dynamic-param-casing-change/[paramA]/page.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import Link from 'next/link' | ||
import React from 'react' | ||
|
||
export default function Page() { | ||
return ( | ||
<> | ||
<Link href="/dynamic-param-casing-change/paramA/paramB"> | ||
/paramA/paramB | ||
</Link> | ||
|
||
<div> | ||
<Link href="/dynamic-param-casing-change/paramA/noParam"> | ||
/paramA/noParam | ||
</Link> | ||
</div> | ||
</> | ||
) | ||
} |
6 changes: 6 additions & 0 deletions
6
test/e2e/app-dir/navigation/app/dynamic-param-casing-change/page.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import Link from 'next/link' | ||
import React from 'react' | ||
|
||
export default function Page() { | ||
return <Link href="/dynamic-param-casing-change/ParamA">/ParamA</Link> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters