Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

757 B
Raw Blame
import { useQueryClient } from '@tanstack/react-query'

import { analyticsKeys } from './keys'

export const useInvalidateAnalyticsQuery = () => {
  const queryClient = useQueryClient()

  const invalidateInfraMonitoringQuery = (
    ref: string,
    {
      attribute,
      startDate,
      endDate,
      interval,
      databaseIdentifier,
    }: {
      attribute?: string
      startDate?: string
      endDate?: string
      interval?: string
      databaseIdentifier?: string
    }
  ) => {
    queryClient.invalidateQueries({
      queryKey: analyticsKeys.infraMonitoring(ref, {
        attribute,
        startDate,
        endDate,
        interval,
        databaseIdentifier,
      }),
    })
  }

  return { invalidateInfraMonitoringQuery }
}