Skip to content

Commit 56f8a59

Browse files
alex-okrushkobrandonroberts
authored andcommitted
fix(store): add the missing bracket in immutability meta-reducer (#1721)
1 parent 20a4d5e commit 56f8a59

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe('immutabilityCheckMetaReducer:', () => {
2323
immutabilityCheckMetaReducer((state, action) => {
2424
reduce(action);
2525
return state;
26-
})({}, { type: 'invoke', numbers: [1, 2, 3] });
26+
})({}, { type: 'invoke', numbers: [1, 2, 3], fun: function() {} });
2727
}
2828
});
2929

@@ -48,7 +48,7 @@ describe('immutabilityCheckMetaReducer:', () => {
4848
});
4949

5050
function invokeReducer(reduce: Function) {
51-
immutabilityCheckMetaReducer((state, _action) => reduce(state))(
51+
immutabilityCheckMetaReducer(state => reduce(state))(
5252
{ numbers: [1, 2, 3] },
5353
{ type: 'invoke' }
5454
);

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ function freeze(target: any) {
1818
Object.getOwnPropertyNames(target).forEach(prop => {
1919
const propValue = target[prop];
2020
if (
21-
hasOwnProperty(target, prop) && targetIsFunction
21+
hasOwnProperty(target, prop) &&
22+
(targetIsFunction
2223
? prop !== 'caller' && prop !== 'callee' && prop !== 'arguments'
23-
: true &&
24-
(isObjectLike(propValue) || isFunction(propValue)) &&
25-
!Object.isFrozen(propValue)
24+
: true) &&
25+
(isObjectLike(propValue) || isFunction(propValue)) &&
26+
!Object.isFrozen(propValue)
2627
) {
2728
freeze(propValue);
2829
}

0 commit comments

Comments
 (0)