Skip to content
This repository has been archived by the owner on Jul 27, 2018. It is now read-only.

Serializing ES6 Sets #67

Open
moniuch opened this issue Jun 28, 2017 · 2 comments
Open

Serializing ES6 Sets #67

moniuch opened this issue Jun 28, 2017 · 2 comments

Comments

@moniuch
Copy link

moniuch commented Jun 28, 2017

Please provide me with instructions on how to pass the {serialize: true} parameter to allow ES6 Sets to be seen in store-devtools

zalmoxisus/redux-devtools-extension#378

The following won't even compile due to mistyping:

StoreDevtoolsModule.instrumentOnlyWithExtension({
  serialize: true,
}),
@juanlizarazo
Copy link

juanlizarazo commented Jul 12, 2017

Similar to #64.
Not serializing Map.

@juanlizarazo
Copy link

@moniuch

I run into this as well.

The new redux devtools extension from version v2.14.0 and up has support for that { serialize: true }.
Unfortunately, @ngrx/store-devtools doesn't support that just yet.

So, my work around in the meantime for nice development experience is to add the .toJSON method to the Map prototype which works great and I can see my maps in state in redux dev tools.

if (environment.envName === 'dev') {
  (Map.prototype as any).toJSON = function () {
    return JSON.parse(JSON.stringify([...this]));
  };
}

Apply same workaround to your Set prototype.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants