@@ -26,6 +26,35 @@ export function provideRouterHistoryStore(): Provider[] {
26
26
return [ provideComponentStore ( RouterHistoryStore ) ] ;
27
27
}
28
28
29
+ // TODO(@LayZeeDK): Handle `NavigationCancel` and `NavigationError` events
30
+ // NavigationStart -> NavigationEnd | NavigationCancel | NavigationError
31
+ //
32
+ // NavigationError resets the URL to what it was before the navigation that caused an error. No new *navigation* is triggered.
33
+ // NavigationError reasons:
34
+ // - Invalid route path
35
+ // NavigationError(id: 3, url: '/an-invalid/path', error: Error: Cannot match any routes. URL Segment: 'an-invalid/path')
36
+ // - Router resolver throws
37
+ // - Route matcher throws
38
+ // - Routed component throws in constructor (or a lifecycle hook?)
39
+ // - Lazy route chunk file is not found (bundles updated and the user needs to refresh)
40
+ // RouterTestingModule.withRoutes([
41
+ // {
42
+ // path: 'stale-chunk',
43
+ // loadChildren: () =>
44
+ // Promise.reject({ name: 'ChunkLoadError', message: 'ChunkLoadError' }),
45
+ // // or () => { throw { name: 'ChunkLoadError', message: 'ChunkLoadError' }; }
46
+ // },
47
+ // ]),
48
+ //
49
+ // What is the URL after each of the following reasons?
50
+ // NavigationCancel reasons:
51
+ // NavigationCancel#code: NavigationCancellationCode
52
+ // - GuardRejected: A navigation failed because a guard returned `false`.
53
+ // - NoDataFromResolver: A navigation failed because one of the resolvers completed without emiting a value.
54
+ // - Redirect: A navigation failed because a guard returned a `UrlTree` to redirect.
55
+ // - SupersededByNewNavigation: A navigation failed because a more recent navigation started.
56
+ // NavigationCancel { id: 3, url: "/company", reason: "Navigation ID 3 is not equal to the current navigation id 4" }
57
+
29
58
@Injectable ( )
30
59
export class RouterHistoryStore extends ComponentStore < RouterHistoryState > {
31
60
#router = inject ( Router ) ;
0 commit comments