handsontable / handsontable

JavaScript data grid with a spreadsheet look & feel. Works with React, Angular, and Vue. Supported by the Handsontable team ⚡
https://handsontable.com
Other
19.69k stars 3.03k forks source link

Redux example mutates data in the store #11098

Open xmedeko opened 1 month ago

xmedeko commented 1 month ago

Page URL

https://handsontable.com/docs/react-data-grid/redux/#simple-example

Improvement description

The Redux example makes data reducer:

action.dataChanges.forEach(([row, column, oldValue, newValue]) => {
        newData[row][column] = newValue;
      });

which mutates initialReduxStoreState and breaks one of the key Reducer Concepts: reducer should not mutate its arguments.

Either fix it, see Redux - Updating an Item in an Array. Or, if it's intentional, describe reasons why the immutability concept is broken and provide the above link how to make it immutable way.

adrianszymanski89 commented 1 month ago

Hi @xmedeko

Thank you for this suggestion. I will add it to our internal repository for further investigation and will update you if we add it to the roadmap.