-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: prevent infinite dev refresh on nested parallel routes (#52362)
### What? HMR causes infinite reloads for parallel routes when the corresponding page component is nested ### Why? In 4900fa2, code was added to remove `/@children` from the page path (if present) but in 59b3634, `normalizeParallelKey` removes the @ prefix from children, so this doesn't seem to be catching the scenario it was intended to prevent ### How? This updates the existing replace logic to consider `/children/page` rather than `/@children/page` -- it doesn't seem like `/@children` is a valid scenario given the `normalizeParallelKey` behavior Fixes #52342 and addresses the concerns in #52061 (comment)
- Loading branch information
Showing
5 changed files
with
44 additions
and
3 deletions.
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
8 changes: 8 additions & 0 deletions
8
...-dir/parallel-routes-and-interception/app/parallel-nested/home/@parallelB/nested/page.tsx
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,8 @@ | ||
export default function ParallelPage() { | ||
return ( | ||
<> | ||
<p>Hello from nested parallel page!</p> | ||
<div id="timestamp">{Date.now()}</div> | ||
</> | ||
) | ||
} |
8 changes: 8 additions & 0 deletions
8
test/e2e/app-dir/parallel-routes-and-interception/app/parallel-nested/home/layout.tsx
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,8 @@ | ||
export default function Layout({ parallelB }: { parallelB: React.ReactNode }) { | ||
return ( | ||
<main> | ||
<h3>{`(parallelB)`}</h3> | ||
<div>{parallelB}</div> | ||
</main> | ||
) | ||
} |
10 changes: 10 additions & 0 deletions
10
test/e2e/app-dir/parallel-routes-and-interception/app/parallel-nested/layout.tsx
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,10 @@ | ||
export default function Parallel({ children }) { | ||
return ( | ||
<div> | ||
parallel/layout: | ||
<div className="parallel" title="children"> | ||
{children} | ||
</div> | ||
</div> | ||
) | ||
} |
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