Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom serializer #1121

Merged
merged 3 commits into from
Jun 13, 2018
Merged

Allow custom serializer #1121

merged 3 commits into from
Jun 13, 2018

Conversation

alex-okrushko
Copy link
Member

serialize can be boolean or object. One of the teams needs to provide custom replacer.

Adjusting the serialize according to the docs for extension:

https://github.com/zalmoxisus/redux-devtools-extension/blob/master/docs/API/Arguments.md#serialize

@coveralls
Copy link

coveralls commented Jun 11, 2018

Coverage Status

Coverage remained the same at 87.971% when pulling 45af831 on alex-okrushko:dev-tools-serializer into 550b67e on ngrx:master.

@@ -60,7 +60,7 @@ export function createConfig(
actionSanitizer: undefined,
stateSanitizer: undefined,
name: DEFAULT_NAME,
serialize: false,
serialize: undefined,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This potentially would be a breaking change, since the existing behavior is to handle circular references. We should have changed with the default serializer for router-store.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell, undefined is recommended default (will use regular JSON.stringify to send data, and it's the fasted mode).
There are concerns that attempting to resolve circular references with JSPB might crash the extension.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -3,14 +3,21 @@ import { InjectionToken, Type } from '@angular/core';

export type ActionSanitizer = (action: Action, id: number) => Action;
export type StateSanitizer = (state: any, index: number) => any;
export type SerializeOptions = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer SerializationOptions here

@alex-okrushko
Copy link
Member Author

Renamed to SerializationOptions.
So is serialize: undefined fine?

@brandonroberts
Copy link
Member

I think we should leave it as false for now. You can configure it to be undefined. We can update the docs for now to recommend it and change the default in V7.

@alex-okrushko
Copy link
Member Author

Done

@brandonroberts brandonroberts merged commit 55a0488 into ngrx:master Jun 13, 2018
@brandonroberts
Copy link
Member

Thanks Alex!

@alex-okrushko alex-okrushko deleted the dev-tools-serializer branch October 30, 2019 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants