Build simple project with ROR and React/Redux RTK. Locally works fine. Also with heroku local. But once I upload to Heroku, when I'm modyfing state with Redux I see error. Completely don't know what to do with it.
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'Symbol(immer-state)')
From stack I see that it happens somewhere around EntityAdapter function call .addOne and .removeOne. While /setAll, and .upsertOne works fine...
Reducer:
extraReducers: (builder) => {
builder
.addCase(fetchTodos.fulfilled, (state, action) => {
state.status = "succeeded";
todosAdapter.setAll(state, action);
})
.addCase(fetchTodos.pending, (state, action) => {
state.status = "loading";
})
.addCase(createTodo.fulfilled, (state, action) => {
todosAdapter.addOne(state, action);
})
.addCase(updateTodo.fulfilled, (state, action) => {
todosAdapter.upsertOne(state, action);
})
.addCase(deleteTodo.fulfilled, (state, action) => {
todosAdapter.removeOne(state, action.payload.id);
});
},