currently the actions only hit the reducer when an action succeeds... doesn't work for optimistic updates. dunno what a solution for that looks like though. seems like you'd traditionally need a lot of boilerplate like
switch (action.type) {
case COMPLETE_TODO:
if (action.status === START) {
return state.setIn(['todos', action.todoId, 'complete'], true);
} else if (action.status === ERROR) {
return state.setIn(['todos', action.todoId, 'complete'], false);
}
}
}
and ofc that only works for actions where you know how to "undo" them
currently the actions only hit the reducer when an action succeeds... doesn't work for optimistic updates. dunno what a solution for that looks like though. seems like you'd traditionally need a lot of boilerplate like
and ofc that only works for actions where you know how to "undo" them