Skip to content

Commit

Permalink
add stale time to vue-query example (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Dec 2, 2024
1 parent 5b4be67 commit 37e496a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/vue-query/pages/+queryClientConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const queryClientConfig: QueryClientConfig = {
defaultOptions: {
queries: {
refetchOnWindowFocus: import.meta.env.PROD,
// staleTime: 1000 * 60 * 5,
},
},
}
2 changes: 2 additions & 0 deletions examples/vue-query/pages/index/+Page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ const components = { Counter }
const { isError, isPending, isFetching, data, error, suspense } = useQuery({
queryKey: ['movies'],
queryFn: fetchMovies,
// Or set global `staleTime` at pages/+queryClientConfig.ts
staleTime: 1000 * 60 * 5,
select: (data) => minimize(data),
})
Expand Down

0 comments on commit 37e496a

Please sign in to comment.