@@ -656,7 +656,7 @@ describe("Lazy Route Discovery (Fog of War)", () => {
656
656
] ) ;
657
657
} ) ;
658
658
659
- it ( "discovers routes during initial hydration when a splat route matches" , async ( ) => {
659
+ it ( "discovers routes during initial SPA renders when a splat route matches" , async ( ) => {
660
660
let childrenDfd = createDeferred < AgnosticDataRouteObject [ ] > ( ) ;
661
661
662
662
router = createRouter ( {
@@ -669,7 +669,7 @@ describe("Lazy Route Discovery (Fog of War)", () => {
669
669
path : "*" ,
670
670
} ,
671
671
] ,
672
- async unstable_patchRoutesOnMiss ( { path , patch, matches } ) {
672
+ async unstable_patchRoutesOnMiss ( { patch } ) {
673
673
let children = await childrenDfd . promise ;
674
674
patch ( null , children ) ;
675
675
} ,
@@ -689,6 +689,37 @@ describe("Lazy Route Discovery (Fog of War)", () => {
689
689
expect ( router . state . matches . map ( ( m ) => m . route . id ) ) . toEqual ( [ "test" ] ) ;
690
690
} ) ;
691
691
692
+ it ( "does not discover routes during initial SSR hydration when a splat route matches" , async ( ) => {
693
+ router = createRouter ( {
694
+ history : createMemoryHistory ( { initialEntries : [ "/test" ] } ) ,
695
+ routes : [
696
+ {
697
+ path : "/" ,
698
+ } ,
699
+ {
700
+ id : "splat" ,
701
+ loader : ( ) => "SPLAT 2" ,
702
+ path : "*" ,
703
+ } ,
704
+ ] ,
705
+ hydrationData : {
706
+ loaderData : {
707
+ splat : "SPLAT 1" ,
708
+ } ,
709
+ } ,
710
+ async unstable_patchRoutesOnMiss ( ) {
711
+ throw new Error ( "Should not be called" ) ;
712
+ } ,
713
+ } ) ;
714
+ router . initialize ( ) ;
715
+
716
+ await tick ( ) ;
717
+ expect ( router . state . initialized ) . toBe ( true ) ;
718
+ expect ( router . state . location . pathname ) . toBe ( "/test" ) ;
719
+ expect ( router . state . loaderData . splat ) . toBe ( "SPLAT 1" ) ;
720
+ expect ( router . state . matches . map ( ( m ) => m . route . id ) ) . toEqual ( [ "splat" ] ) ;
721
+ } ) ;
722
+
692
723
it ( "discovers new root routes" , async ( ) => {
693
724
let childrenDfd = createDeferred < AgnosticDataRouteObject [ ] > ( ) ;
694
725
let childLoaderDfd = createDeferred ( ) ;
0 commit comments