diff --git a/examples/react/optimistic-updates-ui/src/pages/index.tsx b/examples/react/optimistic-updates-ui/src/pages/index.tsx index 18f9bd8714..7e4a8e4b12 100644 --- a/examples/react/optimistic-updates-ui/src/pages/index.tsx +++ b/examples/react/optimistic-updates-ui/src/pages/index.tsx @@ -39,6 +39,9 @@ function Example() { body: JSON.stringify({ text: newTodo }), headers: { 'Content-Type': 'application/json' }, }) + if (!response.ok) { + throw new Error('Something went wrong.') + } return await response.json() }, onSettled: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),