Skip to content

Configuration

Supabase Cache Helpers does a decent job at keeping your data up-to-date. This allows you to deviate from the standard configuration and reduce the number of requests to your backend while keeping your app fresh.

function Page() {
  return (
        <SWRConfig
            value={{
                revalidateIfStale: false,
                revalidateOnFocus: false,
            }}
        >
        ...
        </SWRConfig>
  )
}

Info

You can find more details on the React Query documentation.

function Page() {
  const queryClient = new QueryClient({
    defaultOptions: {
      queries: {
        refetchOnWindowFocus: false,
        staleTime: Infinity,
        gcTime: Infinity,
      },
    },
  });

  return (
    <QueryClientProvider client={queryClient}>
      {/* Your components */}
    </QueryClientProvider>
  );
}