Project

General

Profile

Bug #622

closed

incorrect implementation of reducer

Added by Miroslav Blaško almost 6 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
High
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.

Actions #1

Updated by Miroslav Blaško almost 6 years ago

  • Description updated (diff)
Actions #2

Updated by Miroslav Blaško almost 6 years ago

  • Description updated (diff)

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)

Actions #5

Updated by Tomáš Klíma almost 6 years ago

  • Status changed from New to Resolved
Actions #6

Updated by Miroslav Blaško almost 4 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF