Course lesson

Handle GraphQL Request Errors in Vue 3

What do we do with optimistic updates when things don't go the way we planned? Luckily, the Apollo client is smart and corrects the data, but it might not be clear to the user that their mutation didn't go through.

Duration
3 min
Access
Included
Transcript
Retained from source evidence

What do we do with optimistic updates when things don't go the way we planned? Luckily, the Apollo client is smart and corrects the data, but it might not be clear to the user that their mutation didn't go through.

We can have our component emit and error event and that error can be handled by the parent component. In our case, we'll use a v-if to display a message that informs the user their request didn't go through and the updated values were reverted.