Skip to content
This repository was archived by the owner on Mar 12, 2024. It is now read-only.

Commit 4b195e3

Browse files
chore: fixes to the demo
1 parent d9f401d commit 4b195e3

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

playground/Post.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const [post, { isRefetching, refetch, mutate, error }] = useQuery<Post>(
2626
</button>
2727
</div>
2828
<p>{{ post?.body }}</p>
29-
<button :disabled="isRefetching" @click="() => refetch({ fresh: true })">
29+
<button :disabled="isRefetching" @click="refetch()">
3030
{{ isRefetching ? 'Refetching...' : 'Refetch' }}
3131
</button>
3232
<button @click="() => mutate((current) => ({ ...current!, title: 'Random title here' }))">

playground/PostSuspense.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,16 @@ interface Post {
1212
}
1313
1414
const [post, { isRefetching, refetch, mutate }] = await useAsyncQuery<Post>(
15-
() => `https://jsonplaceholder.typicode.com/posts/${props.id}`,
15+
// The `suspense=true` query is added for different query key than the non-supense one
16+
() => `https://jsonplaceholder.typicode.com/posts/${props.id}?suspense=true`,
1617
)
1718
</script>
1819

1920
<template>
2021
<div>
2122
<h2>{{ post?.title }}</h2>
2223
<p>{{ post?.body }}</p>
23-
<button :disabled="isRefetching" @click="() => refetch({ fresh: true })">
24+
<button :disabled="isRefetching" @click="refetch()">
2425
{{ isRefetching ? 'Refetching...' : 'Refetch' }}
2526
</button>
2627
<button @click="() => mutate((current) => ({ ...current!, title: 'Random title here' }))">

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function injectQueryOptions(value?: TurboVueOptions) {
2020
*/
2121
export async function useAsyncQuery<T = any>(
2222
key: TurboVueKey,
23-
options?: TurboVueOptions,
23+
options?: Omit<TurboVueOptions, 'immediate'>,
2424
): Promise<TurboVueResource<T>> {
2525
const contextOptions = injectQueryOptions()
2626
const turboQuery = options?.turbo?.query ?? contextOptions?.turbo?.query ?? query

0 commit comments

Comments
 (0)