diff --git a/examples/svelte/optimistic-updates/src/routes/api/data/+server.ts b/examples/svelte/optimistic-updates/src/routes/api/data/+server.ts index 46bfe05612..96db577a78 100644 --- a/examples/svelte/optimistic-updates/src/routes/api/data/+server.ts +++ b/examples/svelte/optimistic-updates/src/routes/api/data/+server.ts @@ -19,8 +19,9 @@ export const POST: RequestHandler = async ({ request }) => { const { text } = await request.json() if (Math.random() > 0.7) { - json({ message: 'Could not add item!' }, { status: 500 }) + return json({ message: 'Could not add item!' }, { status: 500 }) } + const newTodo = { id: Math.random().toString(), text: text.toUpperCase() as string,