Bug #622
closedincorrect implementation of reducer
Start date:
07.05.2018
Due date:
% Done:
0%
Estimated time:
Description
I believe that RecordReducer is not correctly implemented as it modifies state instead of creating new one. This might cause various hard to debug problems (e.g. when trying to debug issues with use of time traveling). No tests failed so it might be good idea to add test failing for breaking such contract.
Please, revise other similar occurrences of such mistake.
Relevant code within RecordReducer:
case ActionConstants.DELETE_RECORD_PENDING:
state.recordsDeleting.push(action.key);
return {
...state,
recordDeleted: {
status: ACTION_STATUS.PENDING,
key: action.key
},
};
state.recordsDeleting.push(action.key) call modifies the state.
Updated by Miroslav Blaško almost 6 years ago
Within redux tutorials i believe that i saw a library to test that the state of an object does not change (w.r.t. to deep structure of the object) during execution of tests.
Updated by Miroslav Blaško almost 6 years ago
-- something like expectImmutable(obj)
Updated by Miroslav Blaško almost 4 years ago
- Status changed from Resolved to Closed