My redux toolkit / immer slice is doing a mutation, but that is allowed, why am i getting the mutation was detected error? Is it my reducer?
Error: Invariant failed: A state mutation was detected between dispatches, in the path 'components.component_159275.input.options'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)
reduxDispatch(updateValue({ componentId, value }));
export const componentsSlice = createSlice({
name: 'COMPONENTS',
initialState: defaultState.components,
reducers: {
updateValue(state, action) {
const { payload } = action;
const { componentId, value } = payload;
state[`component_${componentId}`].component.input.value = value;
},
},
});
I have this rule, in eslintrc to allow param reassign, is there a rule i am missing that i need to add?
"no-param-reassign": [ // allows us to reassign where the param which is used in that is state or ctx.
"error",
{ "props": true, "ignorePropertyModificationsFor": ["state", "ctx"] }
],
Thank you for you help.