bencripps / react-redux-grid

A React Grid/Tree Component written in the Redux Pattern
http://react-redux-grid.herokuapp.com/
MIT License
446 stars 63 forks source link

Tree, selection throwing an mutation exception on action @@react-redux-grid/SET_SELECTION #230

Open Birtija opened 4 years ago

Birtija commented 4 years ago

I used grid type Tree like this:

 const complexData = {
    showTreeRootNode: false,
    dataSource: (extraParams) =>
      getChildEntities(props.requestType, extraParams),
    gridType: "tree",
    dragAndDrop: false,
    columns: columns,
    store: store,
    stateKey: "tree-grid-oj",
    plugins: {
      GRID_ACTIONS: null,
      SELECTION_MODEL: {
        mode: "single",
      },
    },
    events: props.events,
  };

  return <Grid {...complexData} />;

my combined reducer:

const rootReducer = combineReducers({
 //other reducers for business logic

  //reducers for the react-redux-grid library
  grid: gridReducers.grid,
  dataSource: gridReducers.dataSource,
  errorHandler: gridReducers.errorHandler,
  loader: gridReducers.loader,
  selection: gridReducers.selection,
});

When i use the tree grid without the SELECTION_MODEL part in the plugins evertything works fine, but when i include it i get the following error:

Uncaught Invariant Violation: A state mutation was detected inside a dispatch, in the path: selection._list._tail.array.0.1._list._tail.array.1.1.1. Take a look at the reducer(s) handling the action {"type":"@@react-redux-grid/SET_SELECTION","id":"tree-item-2","clearSelections":true,"allowDeselect":true,"index":1,"stateKey":"tree-grid-oj"}

I looked at the demo examples but could not find anything that could affect this issue.

Is this a bug or did i do something wrong?