Skip to content

Commit

Permalink
Ignore HTML Elements in ReduxDevTools (#57497)
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Feb 24, 2024
1 parent 5be7d52 commit 70e5316
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/data/src/redux-store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,16 @@ const mapValues = ( obj, callback ) =>
] )
);

// Convert Map objects to plain objects
const mapToObject = ( key, state ) => {
// Convert non serializable types to plain objects
const devToolsReplacer = ( key, state ) => {
if ( state instanceof Map ) {
return Object.fromEntries( state );
}

if ( state instanceof window.HTMLElement ) {
return null;
}

return state;
};

Expand Down Expand Up @@ -421,7 +425,7 @@ function instantiateReduxStore( key, options, registry, thunkArgs ) {
name: key,
instanceId: key,
serialize: {
replacer: mapToObject,
replacer: devToolsReplacer,
},
} )
);
Expand Down

0 comments on commit 70e5316

Please sign in to comment.