Commit cfb17b03 authored by Jimmy Lai's avatar Jimmy Lai

fix: exclude catch-alls from dynamic guard and filter interception routes

parent f0f1c03a
...@@ -1354,7 +1354,11 @@ async fn directory_tree_to_loader_tree_internal( ...@@ -1354,7 +1354,11 @@ async fn directory_tree_to_loader_tree_internal(
// However, if a static subdirectory at this level directly matches the // However, if a static subdirectory at this level directly matches the
// target path, dynamic segment subdirectories should not use dynamic // target path, dynamic segment subdirectories should not use dynamic
// matching (static routes take priority over dynamic ones). // matching (static routes take priority over dynamic ones).
let child_match_dynamic = if has_static_match_at_this_level // Catch-all directories (e.g. [...slug]) are also excluded from dynamic
// matching because they have their own catch-all matching logic.
let child_match_dynamic = if subdir_name.contains("...") {
false
} else if has_static_match_at_this_level
&& is_dynamic_segment(subdir_name) && is_dynamic_segment(subdir_name)
&& parallel_route_key.is_none() && parallel_route_key.is_none()
{ {
......
...@@ -95,7 +95,8 @@ function normalizeDynamicRoutes( ...@@ -95,7 +95,8 @@ function normalizeDynamicRoutes(
(route) => (route) =>
route.includes('@') && route.includes('@') &&
hasDynamicSegment(route) && hasDynamicSegment(route) &&
!isCatchAllRoute(route) !isCatchAllRoute(route) &&
!isInterceptionRouteAppPath(route)
) )
// Prefer more specific (deeper) routes first. // Prefer more specific (deeper) routes first.
.sort((a, b) => b.split('/').length - a.split('/').length) .sort((a, b) => b.split('/').length - a.split('/').length)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment