Skip to content

Commit

Permalink
applied PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
david-shortman committed Jun 1, 2022
1 parent 0f01e06 commit 9c6d631
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 12 deletions.
7 changes: 3 additions & 4 deletions modules/router-store/src/router_store_module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ export type StateKeyOrSelector<
> = string | Selector<any, RouterReducerState<T>>;

/**
* Full = Serializes the router event with FullRouterStateSerializer
* Minimal = Serializes the router event with MinimalRouterStateSerializer
* Full = Serializes the router event with FullRouterStateSerializer
*/
export const enum RouterState {
Full,
Expand All @@ -72,8 +72,8 @@ export interface StoreRouterConfig<
navigationActionTiming?: NavigationActionTiming;
/**
* Decides which router serializer should be used, if there is none provided, and the metadata on the dispatched @ngrx/router-store action payload.
* Set to `Full` to use the `FullRouterStateSerializer` and to set the angular router events as payload.
* Set to `Minimal` to use the `MinimalRouterStateSerializer` and to set a minimal router event with the navigation id and url as payload.
* Set to `Full` to use the `FullRouterStateSerializer` and to set the angular router events as payload.
*/
routerState?: RouterState;
}
Expand Down Expand Up @@ -213,8 +213,7 @@ export class StoreRouterConnectingModule {
'with the FullRouterStateSerializer. The FullRouterStateSerializer ' +
'has an unserializable router state and actions that are not serializable. ' +
'To use the serializability runtime checks either use ' +
'the MinimalRouterStateSerializer or implement a custom router state serializer. ' +
'This also applies to Ivy with immutability runtime checks.'
'the MinimalRouterStateSerializer or implement a custom router state serializer.'
);
}

Expand Down
3 changes: 0 additions & 3 deletions modules/router-store/src/serializers/full_serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ export interface SerializedRouterStateSnapshot extends BaseRouterStoreState {
url: string;
}

/**
* @deprecated The FullRouterStateSerializer cannot be used when serializability runtime checks are enabled. Use the {@link MinimalRouterStateSerializer} or a {@link https://ngrx.io/guide/router-store/configuration#custom-router-state-serializer custom serializer} instead.
*/
export class FullRouterStateSerializer
implements RouterStateSerializer<SerializedRouterStateSnapshot>
{
Expand Down
8 changes: 4 additions & 4 deletions projects/ngrx.io/content/guide/router-store/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ This property decides which router serializer should be used. If there is a cust

### RouterState.Minimal

`RouterState.Minimal` will use the `MinimalRouterStateSerializer` serializer to serialize the Angular Router's `RouterState` and `RouterEvent`.
`RouterState.Minimal` uses the `MinimalRouterStateSerializer` serializer to serialize the Angular Router's `RouterState` and `RouterEvent`.

The difference between `FullRouterStateSerializer` and the `MinimalRouterStateSerializer` is that this serializer is fully serializable. To make the state and the actions serializable, the properties `paramMap`, `queryParamMap` and `component` are ignored.

Expand All @@ -113,9 +113,9 @@ StoreRouterConnectingModule.forRoot({

### RouterState.Full

When this property is set to `RouterState.Full`, `@ngrx/router-store` will use the `FullRouterStateSerializer` serializer to serialize the Angular router event.
When this property is set to `RouterState.Full`, `@ngrx/router-store` uses the `FullRouterStateSerializer` serializer to serialize the Angular router event.

The metadata on the action will contain the Angular router event, e.g. `NavigationStart` and `RoutesRecognized`.
The metadata on the action contains the Angular router event, e.g. `NavigationStart` and `RoutesRecognized`.

<code-example header="app.module.ts">
StoreRouterConnectingModule.forRoot({
Expand All @@ -126,6 +126,6 @@ StoreRouterConnectingModule.forRoot({
<div class="alert is-important">

The `FullRouterStateSerializer` cannot be used when [serializability runtime checks](guide/store/configuration/runtime-checks) are enabled.
With serializability runtime checks enabled, the `MinimalRouterStateSerializer` serializer **must** be used. This also applies to Ivy with immutability runtime checks.
With serializability runtime checks enabled, the `MinimalRouterStateSerializer` serializer **must** be used.

</div>
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export class AppModule {}
<div class="alert is-important">

The serializability runtime checks cannot be enabled if you use `@ngrx/router-store` with the `FullRouterStateSerializer`. The [full serializer](guide/router-store/configuration) has an unserializable router state and actions that are not serializable. To use the serializability runtime checks either use the `MinimalRouterStateSerializer` or implement a custom router state serializer.
This also applies to Ivy with immutability runtime checks.

</div>

Expand Down

0 comments on commit 9c6d631

Please sign in to comment.