From aa85a4f371d8c5dbf9f44a59180bdaf82abe2962 Mon Sep 17 00:00:00 2001 From: st-imdev <124273900+st-imdev@users.noreply.github.com> Date: Sun, 8 Feb 2026 15:27:03 +0000 Subject: [PATCH 1/2] fix: handle undefined children in isSameRoute for sibling layouts When navigating between routes in sibling layouts via RSC, the server returns route patches without a children property. In isSameRoute(), the "both empty" check on lines 5374-5379 only returns true when both routes lack children. When newRoute.children is undefined but existingRoute.children has items, execution falls through to the .every() call which crashes with "can't access property 'every', newRoute.children is undefined". Add an explicit guard after the joint empty-children check: if either route has children but the other doesn't, they are definitively different routes. This also removes the non-null assertion on newRoute.children since the guard ensures both sides have children. Fixes: https://github.com/remix-run/react-router/issues/14777 Co-authored-by: Cursor --- packages/react-router/lib/router/router.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/react-router/lib/router/router.ts b/packages/react-router/lib/router/router.ts index 34c74cc28d..ebf470b87d 100644 --- a/packages/react-router/lib/router/router.ts +++ b/packages/react-router/lib/router/router.ts @@ -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)), ); } From 904d43a3a6edaabd7a20fac12ae2bde6419837ad Mon Sep 17 00:00:00 2001 From: st-imdev <124273900+st-imdev@users.noreply.github.com> Date: Sun, 8 Feb 2026 15:29:03 +0000 Subject: [PATCH 2/2] chore: sign CLA Co-authored-by: Cursor --- contributors.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/contributors.yml b/contributors.yml index 0966b71f78..930896497b 100644 --- a/contributors.yml +++ b/contributors.yml @@ -470,6 +470,7 @@ - yuleicul - yuri-poliantsev - zeevick10 +- scott-memco - zeromask1337 - zheng-chuang - zxTomw