Skip to content
This repository was archived by the owner on Jul 25, 2022. It is now read-only.

Commit a29836d

Browse files
committed
fix ngrx/router-store Chrome Redux DevTools Extension crashing issue.fix ngrx/router-store Chrome Redux DevTools Extension crashing
Ref: ngrx/platform#537
1 parent fc82678 commit a29836d

File tree

3 files changed

+7
-27
lines changed

3 files changed

+7
-27
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ But there are only three differences at properties level:
161161

162162
Since it's based on `ActivatedRouteSnapshot`, you can also access to their properties as usual with the exception that `url` was moved to `urlSegments` and `url` is now current string url.
163163

164+
More details about available properties at [router-state.ts](./src/router-state.ts) file.
165+
164166
### Operators
165167

166168
[RxJS](https://angular.io/guide/rx-library) operators:

src/router-state.ts

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { Type } from '@angular/core'
2-
import { ActivatedRouteSnapshot, Data, ParamMap, Params, Route, UrlSegment } from '@angular/router'
2+
import { Data, Params, UrlSegment } from '@angular/router'
33
import { RouterNavigationPayload } from '@ngrx/router-store'
44

55
/** RouterStateSegments intersection type (token segments mapping object) */
66
export type RouterStateTokenSegments<T> = T & { [key: string]: string }
77

88
/**
9-
* Router activated snapshot state extended of `@angular/router/ActivatedRouteSnapshot`
9+
* Router activated snapshot state based on `@angular/router/ActivatedRouteSnapshot`
1010
*
1111
* - ActivatedRouteSnapshot: https://angular.io/api/router/ActivatedRouteSnapshot#description
1212
* - ActivatedRouteSnapshot source: https://github.com/angular/angular/blob/master/packages/router/src/router_state.ts
@@ -30,23 +30,9 @@ export interface RouterStatePlusActivatedSnapshot<RouterTokenSegments> {
3030
outlet: string
3131
/** The component of the route */
3232
component: Type<any> | string | null
33-
/** The configuration used to match this route */
34-
readonly routeConfig: Route | null
35-
/** The root of the router state */
36-
readonly root: ActivatedRouteSnapshot
37-
/** The parent of this route in the router state tree */
38-
readonly parent: ActivatedRouteSnapshot | null
39-
/** The first child of this route in the router state tree */
40-
readonly firstChild: ActivatedRouteSnapshot | null
41-
/** The children of this route in the router state tree */
42-
readonly children: ActivatedRouteSnapshot[]
43-
/** The path from the root of the router state tree to this route */
44-
readonly pathFromRoot: ActivatedRouteSnapshot[]
45-
readonly paramMap: ParamMap
46-
readonly queryParamMap: ParamMap
47-
toString (): string
4833
}
4934

35+
/** The router navigation payload extended of NgRx RouterNavigationPayload */
5036
export interface RouterNavPayload<RouterTokenSegments = {}>
5137
extends RouterNavigationPayload<RouterStatePlusActivatedSnapshot<RouterTokenSegments>> {
5238
}

src/serializer.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class RouterStateSerializerPlus<RouterTokenSegments> implements
3434
): RouterStatePlusActivatedSnapshot<RouterTokenSegments> {
3535
let route = routerState.root
3636

37-
if (route.firstChild) {
37+
while (route.firstChild) {
3838
route = route.firstChild
3939
}
4040

@@ -49,15 +49,7 @@ export class RouterStateSerializerPlus<RouterTokenSegments> implements
4949
fragment: route.fragment,
5050
data: route.data,
5151
outlet: route.outlet,
52-
component: route.component,
53-
routeConfig: route.routeConfig,
54-
root: route.root,
55-
parent: route.parent,
56-
firstChild: route.firstChild,
57-
children: route.children,
58-
pathFromRoot: route.pathFromRoot,
59-
paramMap: route.paramMap,
60-
queryParamMap: route.queryParamMap
52+
component: route.component
6153
}
6254
}
6355

0 commit comments

Comments
 (0)