Open History to see the last commit
1<script lang="ts">
2 import { QueryClient } from '@tanstack/query-core'
3 import { createMutation, setQueryClientContext } from '../../src/index.js'
4 import { sleep } from '@tanstack/query-test-utils'
5β
6 const queryClient = new QueryClient()
7 setQueryClientContext(queryClient)
8β
9 const mutation = createMutation(() => ({
10 mutationFn: () =>
11 sleep(10).then(() => Promise.reject(new Error('Expected mock error'))),
12 }))
13</script>
14β
15<button onclick={() => mutation.reset()}>Reset</button>
16<button onclick={() => mutation.mutate()}>Mutate</button>
17β
18<div>Error: {mutation.error?.message ?? 'undefined'}</div>