-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Maps/Sets can't be viewed in devtools #632
Comments
The |
Thanks for the pointer in the right direction, Brandon! Just in case anyone else wants a quick solution to this, // polyfills.ts
import 'core-js/es7/map'; |
Thanks @berwyn , you saved the day! :) |
@berwyn - Thank you very much! Appreciate you left a note on this ticket. 🥇 |
@berwyn Thank you, buddy! |
It looks like the |
A manually implemented poly fill may also work: Store-DevTools #64 if (environment.envName === 'dev') {
(Map.prototype as any).toJSON = function () {
return JSON.parse(JSON.stringify([...this]));
};
} |
Here's a simple one for Sets: (Set.prototype as any).toJSON = function() {
return Array.from(this);
}; |
import { legacy_createStore as createStore, applyMiddleware } from "redux"; const composeEnhancers = composeWithDevTools({ serialize: true }); export const store = createStore( //WORKED FOR ME .... |
I'm submitting a...
What is the current behavior?
As noted in ngrx/store-devtools#64 and ngrx/store-devtools#67 using an ES2015 Set or Map works well enough in ngrx, but the devtools won't display the object instead showing an empty object (
{ }
) when it's first set, and omitting the object in diffs. Additionally, when looking at the graph of the store, the Set/Map will show up as a node, but have no associated value.Expected behavior:
Devtools should show that a Set/Map was used, and that it was updated as a result of an action.
Minimal reproduction of the problem with instructions:
given:
and
any reducer that updates this field will succeed, however this property will not be displayed correctly in the devtools, and will not exist in diffs.
Version of affected browser(s),operating system(s), npm, node and ngrx:
[email protected]
[email protected]
@ngrx/[email protected]
@ngrx/[email protected]
@ngrx/[email protected]
Other information:
Based on the other bugs, it seems that the devtools extension may have a
serialize
argument that may alleviate this, however passing this to ngrx doesn't seem to do anything different, so I'm unsure if there's work on the ngrx side to support this.The text was updated successfully, but these errors were encountered: