The update function should be pure, deriving the optimistic state from the current state and the optimistic input.