Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

window-focus-refetching.md

40 lines726 Bytes

export const appConfig: ApplicationConfig = {
  providers: [
    provideTanStackQuery(
      () =>
        new QueryClient({
          defaultOptions: {
            queries: {
              refetchOnWindowFocus: false, // default: true
            },
          },
        }),
    ),
  ],
}
injectQuery(() => ({
  queryKey: ['todos'],
  queryFn: fetchTodos,
  refetchOnWindowFocus: false,
}))