IT DOESN'T WORK PROPERLY
const state = context.getState();
state.permissions = action.payload;
context.setState(state);
IT WORKS
const state = context.getState();
state.permissions = action.payload;
context.setState({ ...state });
IT WORKS
const state = context.getState();
state.permissions = action.payload;
context.patchState(state);
All the examples update the state... but the first one doesn't activate the observable for state changes, because state is immutable, that means you cannot simple edit it and save it, it is not editable and you always will have to clone the old state, edit your new copy and save this new state. patchState
just does it for you.