@@ -26,6 +26,35 @@ export function provideRouterHistoryStore(): Provider[] {
2626 return [ provideComponentStore ( RouterHistoryStore ) ] ;
2727}
2828
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+
2958@Injectable ( )
3059export class RouterHistoryStore extends ComponentStore < RouterHistoryState > {
3160 #router = inject ( Router ) ;
0 commit comments