Skip to content

Commit

Permalink
fix: IE11 clone() (#1029)
Browse files Browse the repository at this point in the history
* Fix clone() for IE11

Moving `_whitelist` and `_blacklist` initializations inside `proto` fixes: `createSetIterator called on incompatible receiver` error in IE11

* Clone _whitelist and _blacklist properly

Improvement on previous commit

* white space revert

* Add missing key
  • Loading branch information
TheHalcyonSavant committed Oct 21, 2020
1 parent 7459544 commit 7fd80aa
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/mixed.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,13 @@ const proto = (SchemaType.prototype = {

// if the nested value is a schema we can skip cloning, since
// they are already immutable
return cloneDeepWith(this, (value) => {
return cloneDeepWith(this, (value, key) => {
if (isSchema(value) && value !== this) return value;

// fix for ie11 when cloning Set and Map
if (key === '_whitelist' || key === '_blacklist') {
return value.clone();
}
});
},

Expand Down

0 comments on commit 7fd80aa

Please sign in to comment.