Skip to content

Commit 11c0864

Browse files
jonrimmerbrandonroberts
authored andcommitted
fix(store): add immutability check for IE compatibility (#1997)
IE errors when attempting to access the `caller` property of a function, so rearrange the freeze function to check for this first. Fixes #1991
1 parent 2b8178d commit 11c0864

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

modules/store/src/meta-reducers/immutability_reducer.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,20 @@ function freeze(target: any) {
2020
const targetIsFunction = isFunction(target);
2121

2222
Object.getOwnPropertyNames(target).forEach(prop => {
23-
const propValue = target[prop];
2423
if (
2524
hasOwnProperty(target, prop) &&
2625
(targetIsFunction
2726
? prop !== 'caller' && prop !== 'callee' && prop !== 'arguments'
28-
: true) &&
29-
(isObjectLike(propValue) || isFunction(propValue)) &&
30-
!Object.isFrozen(propValue)
27+
: true)
3128
) {
32-
freeze(propValue);
29+
const propValue = target[prop];
30+
31+
if (
32+
(isObjectLike(propValue) || isFunction(propValue)) &&
33+
!Object.isFrozen(propValue)
34+
) {
35+
freeze(propValue);
36+
}
3337
}
3438
});
3539

0 commit comments

Comments
 (0)