@@ -60,6 +60,28 @@ let _enableAsyncRouteHandlers: boolean = false;
60
60
61
61
const CLIENTS_WITH_INSTRUMENT_NAVIGATION = new WeakSet < Client > ( ) ;
62
62
63
+ /**
64
+ * Adds resolved routes as children to the parent route.
65
+ * Prevents duplicate routes by checking if they already exist.
66
+ */
67
+ export function addResolvedRoutesToParent ( resolvedRoutes : RouteObject [ ] , parentRoute : RouteObject ) : void {
68
+ const existingChildren = parentRoute . children || [ ] ;
69
+
70
+ const newRoutes = resolvedRoutes . filter (
71
+ newRoute =>
72
+ ! existingChildren . some (
73
+ existing =>
74
+ existing === newRoute ||
75
+ ( newRoute . path && existing . path === newRoute . path ) ||
76
+ ( newRoute . id && existing . id === newRoute . id ) ,
77
+ ) ,
78
+ ) ;
79
+
80
+ if ( newRoutes . length > 0 ) {
81
+ parentRoute . children = [ ...existingChildren , ...newRoutes ] ;
82
+ }
83
+ }
84
+
63
85
/**
64
86
* Updates a navigation span with the correct route name after lazy routes have been loaded.
65
87
*/
@@ -788,25 +810,3 @@ export function createNewNavigationSpan(
788
810
) ;
789
811
}
790
812
}
791
-
792
- /**
793
- * Adds resolved routes as children to the parent route.
794
- * Prevents duplicate routes by checking if they already exist.
795
- */
796
- export function addResolvedRoutesToParent ( resolvedRoutes : RouteObject [ ] , parentRoute : RouteObject ) : void {
797
- const existingChildren = parentRoute . children || [ ] ;
798
-
799
- const newRoutes = resolvedRoutes . filter (
800
- newRoute =>
801
- ! existingChildren . some (
802
- existing =>
803
- existing === newRoute ||
804
- ( newRoute . path && existing . path === newRoute . path ) ||
805
- ( newRoute . id && existing . id === newRoute . id ) ,
806
- ) ,
807
- ) ;
808
-
809
- if ( newRoutes . length > 0 ) {
810
- parentRoute . children = [ ...existingChildren , ...newRoutes ] ;
811
- }
812
- }
0 commit comments