Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,7 @@
- yuleicul
- yuri-poliantsev
- zeevick10
- scott-memco
- zeromask1337
- zheng-chuang
- zxTomw
10 changes: 8 additions & 2 deletions packages/react-router/lib/router/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5378,10 +5378,16 @@ function isSameRoute(
return true;
}

// If only one side has children, they're different routes (e.g., sibling
// layouts where one has been patched with children and the other hasn't)
if (!newRoute.children?.length || !existingRoute.children?.length) {
return false;
}

// Otherwise, we look to see if every child in the new route is already
// represented in the existing route's children
return newRoute.children!.every((aChild, i) =>
existingRoute.children?.some((bChild) => isSameRoute(aChild, bChild)),
return newRoute.children.every((aChild) =>
existingRoute.children!.some((bChild) => isSameRoute(aChild, bChild)),
);
}

Expand Down