'use client'

import { QueryClient, QueryClientProvider, HydrationBoundary } from '@tanstack/react-query'
import { ReactNode, useState } from 'react'

export default function QueryProvider({ children }: { children: ReactNode }) {
  const [client] = useState(() => new QueryClient({
    defaultOptions: {
      queries: {
        staleTime: 1000 * 60 * 5, // داده‌ها برای 5 دقیقه معتبر هستند

      }
    }
  }))

  return (
    <QueryClientProvider client={client}>
      <HydrationBoundary state={{}}>
        {children}
      </HydrationBoundary>
    </QueryClientProvider>
  )
}