Project

General

Profile

Bug #622

Updated by Miroslav Blaško about 6 years ago

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 braking such contract.  

 Please, revise other similar occurrences of such mistake. 

 Relevant code within RecordReducer: 
 <pre><code class="javascript"> 
        case ActionConstants.DELETE_RECORD_PENDING: 
             state.recordsDeleting.push(action.key); 
             return { 
                 ...state, 
                 recordDeleted: { 
                     status: ACTION_STATUS.PENDING, 
                     key: action.key 
                 }, 
             }; 
 </code></pre> 

 state.recordsDeleting.push(action.key) call modifies the state.

Back