File tree Expand file tree Collapse file tree 3 files changed +14
-1
lines changed
packages/kit/src/runtime/client Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -496,6 +496,14 @@ export class Renderer {
496
496
) ;
497
497
if ( result ) return result ;
498
498
}
499
+
500
+ if ( info . initial ) {
501
+ return await this . _load_error ( {
502
+ status : 404 ,
503
+ error : new Error ( `Not found: ${ info . url . pathname } ` ) ,
504
+ url : info . url
505
+ } ) ;
506
+ }
499
507
}
500
508
501
509
/**
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ export class Router {
51
51
renderer . router = this ;
52
52
53
53
this . enabled = true ;
54
+ this . initialized = false ;
54
55
55
56
// make it possible to reset focus
56
57
document . body . setAttribute ( 'tabindex' , '-1' ) ;
@@ -252,6 +253,8 @@ export class Router {
252
253
) ;
253
254
}
254
255
} ) ;
256
+
257
+ this . initialized = true ;
255
258
}
256
259
257
260
/**
@@ -274,7 +277,8 @@ export class Router {
274
277
id : url . pathname + url . search ,
275
278
routes : this . routes . filter ( ( [ pattern ] ) => pattern . test ( path ) ) ,
276
279
url,
277
- path
280
+ path,
281
+ initial : ! this . initialized
278
282
} ;
279
283
}
280
284
}
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ export type NavigationInfo = {
5
5
routes : CSRRoute [ ] ;
6
6
url : URL ;
7
7
path : string ;
8
+ initial : boolean ;
8
9
} ;
9
10
10
11
export type NavigationCandidate = {
You can’t perform that action at this time.
0 commit comments