The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore: Migrate leftover query keys (#40573)
Ivan Vasilovc83d7255a4ba
diff --git a/apps/studio/data/analytics/project-metrics-query.ts b/apps/studio/data/analytics/project-metrics-query.tsindex 8862aad3254..041296b5778 100644--- a/apps/studio/data/analytics/project-metrics-query.ts+++ b/apps/studio/data/analytics/project-metrics-query.ts@@ -1,9 +1,10 @@-import { useQuery, type UseQueryOptions } from '@tanstack/react-query'+import { useQuery } from '@tanstack/react-query'import { z } from 'zod'import { fetchGet } from 'data/fetchers'import { API_URL, IS_PLATFORM } from 'lib/constants'import { analyticsKeys } from './keys'+import { UseCustomQueryOptions } from 'types'export type ProjectMetricsVariables = {projectRef?: string@@ -100,7 +101,7 @@ export const useProjectMetricsQuery = <TData = ProjectMetricsData>({enabled = true,...options- }: UseQueryOptions<ProjectMetricsData, ProjectMetricsError, TData> = {}+ }: UseCustomQueryOptions<ProjectMetricsData, ProjectMetricsError, TData> = {}) => {const { projectRef, interval } = varsdiff --git a/apps/studio/data/auth/users-infinite-query.ts b/apps/studio/data/auth/users-infinite-query.tsindex 9db0b6bbf67..f6f97b6f66c 100644--- a/apps/studio/data/auth/users-infinite-query.ts+++ b/apps/studio/data/auth/users-infinite-query.ts@@ -53,7 +53,7 @@ export const useUsersInfiniteQuery = <TData = UsersData>(projectRef,connectionString,sql: getPaginatedUsersSQL({- page: column ? undefined : pageParam,+ page: column ? undefined : (pageParam as number),verified: filter,keywords,providers,@@ -61,7 +61,7 @@ export const useUsersInfiniteQuery = <TData = UsersData>(order: order ?? 'asc',limit: USERS_PAGE_LIMIT,column,- startAt: column ? pageParam : undefined,+ startAt: column ? (pageParam as string) : undefined,}),queryKey: authKeys.usersInfinite(projectRef),},diff --git a/apps/studio/data/content/content-infinite-query.ts b/apps/studio/data/content/content-infinite-query.tsindex 87f8ff26df9..94c953b7ac8 100644--- a/apps/studio/data/content/content-infinite-query.ts+++ b/apps/studio/data/content/content-infinite-query.ts@@ -7,7 +7,7 @@ import { contentKeys } from './keys'interface GetContentVariables {projectRef?: string- cursor?: string+ cursor?: string | undefinedtype: ContentTypename?: stringlimit?: numberdiff --git a/apps/studio/data/database-cron-jobs/database-cron-jobs-runs-infinite-query.ts b/apps/studio/data/database-cron-jobs/database-cron-jobs-runs-infinite-query.tsindex cfe071f6106..049b7a6d64f 100644--- a/apps/studio/data/database-cron-jobs/database-cron-jobs-runs-infinite-query.ts+++ b/apps/studio/data/database-cron-jobs/database-cron-jobs-runs-infinite-query.ts@@ -32,7 +32,7 @@ export async function getDatabaseCronJobRuns({connectionString,jobId,afterTimestamp,-}: DatabaseCronJobRunsVariables & { afterTimestamp: string }) {+}: DatabaseCronJobRunsVariables & { afterTimestamp: string | undefined }) {if (!projectRef) throw new Error('Project ref is required')let query = `diff --git a/apps/studio/data/database-queues/database-queue-messages-infinite-query.ts b/apps/studio/data/database-queues/database-queue-messages-infinite-query.tsindex cf7e3c557d8..c392fbd5645 100644--- a/apps/studio/data/database-queues/database-queue-messages-infinite-query.ts+++ b/apps/studio/data/database-queues/database-queue-messages-infinite-query.ts@@ -33,7 +33,7 @@ export async function getDatabaseQueue({queueName,afterTimestamp,status,-}: DatabaseQueueVariables & { afterTimestamp: string }) {+}: DatabaseQueueVariables & { afterTimestamp: string | undefined }) {if (!projectRef) throw new Error('Project ref is required')if (!isQueueNameValid(queueName)) {throw new Error(diff --git a/apps/studio/data/logs/unified-logs-infinite-query.ts b/apps/studio/data/logs/unified-logs-infinite-query.tsindex 70bb70e9322..8013c05f4a2 100644--- a/apps/studio/data/logs/unified-logs-infinite-query.ts+++ b/apps/studio/data/logs/unified-logs-infinite-query.ts@@ -47,7 +47,7 @@ export const getUnifiedLogsISOStartEnd = (}export async function getUnifiedLogs(- { projectRef, search, pageParam }: UnifiedLogsVariables & { pageParam?: PageParam },+ { projectRef, search, pageParam }: UnifiedLogsVariables & { pageParam: PageParam | null },signal?: AbortSignal,headersInit?: HeadersInit) {@@ -170,12 +170,11 @@ export const useUnifiedLogsInfiniteQuery = <TData = UnifiedLogsData>(keepPreviousData: true,getPreviousPageParam: (firstPage) => {if (!firstPage.prevCursor) return null- const result = { cursor: firstPage.prevCursor, direction: 'prev' }- return result+ return { cursor: firstPage.prevCursor, direction: 'prev' } as const},getNextPageParam(lastPage) {if (!lastPage.nextCursor || lastPage.data.length === 0) return null- return { cursor: lastPage.nextCursor, direction: 'next' }+ return { cursor: lastPage.nextCursor, direction: 'next' } as const},...UNIFIED_LOGS_QUERY_OPTIONS,...options,diff --git a/apps/studio/data/notifications/notifications-v2-query.ts b/apps/studio/data/notifications/notifications-v2-query.tsindex ffd00de107d..39ba36d5f0a 100644--- a/apps/studio/data/notifications/notifications-v2-query.ts+++ b/apps/studio/data/notifications/notifications-v2-query.ts@@ -8,7 +8,7 @@ import { notificationKeys } from './keys'const NOTIFICATIONS_PAGE_LIMIT = 10export type NotificationVariables = {- page: number+ page: number | undefinedlimit?: numberstatus?: 'new' | 'seen' | 'archived'filters: {diff --git a/apps/studio/data/storage/analytics-bucket-create-mutation.ts b/apps/studio/data/storage/analytics-bucket-create-mutation.tsindex 97d4ddc0f31..5a39884b1f3 100644--- a/apps/studio/data/storage/analytics-bucket-create-mutation.ts+++ b/apps/studio/data/storage/analytics-bucket-create-mutation.ts@@ -45,7 +45,7 @@ export const useAnalyticsBucketCreateMutation = ({mutationFn: (vars) => createAnalyticsBucket(vars),async onSuccess(data, variables, context) {const { projectRef } = variables- await queryClient.invalidateQueries(storageKeys.analyticsBuckets(projectRef))+ await queryClient.invalidateQueries({ queryKey: storageKeys.analyticsBuckets(projectRef) })await onSuccess?.(data, variables, context)},async onError(data, variables, context) {diff --git a/apps/studio/data/storage/analytics-bucket-delete-mutation.ts b/apps/studio/data/storage/analytics-bucket-delete-mutation.tsindex 05971d4bfdf..01a99245856 100644--- a/apps/studio/data/storage/analytics-bucket-delete-mutation.ts+++ b/apps/studio/data/storage/analytics-bucket-delete-mutation.ts@@ -42,7 +42,7 @@ export const useAnalyticsBucketDeleteMutation = ({mutationFn: (vars) => deleteAnalyticsBucket(vars),async onSuccess(data, variables, context) {const { projectRef } = variables- await queryClient.invalidateQueries(storageKeys.analyticsBuckets(projectRef))+ await queryClient.invalidateQueries({ queryKey: storageKeys.analyticsBuckets(projectRef) })await onSuccess?.(data, variables, context)},async onError(data, variables, context) {diff --git a/apps/studio/data/storage/vector-bucket-create-mutation.ts b/apps/studio/data/storage/vector-bucket-create-mutation.tsindex 749b2a906e1..ece577f073c 100644--- a/apps/studio/data/storage/vector-bucket-create-mutation.ts+++ b/apps/studio/data/storage/vector-bucket-create-mutation.ts@@ -41,7 +41,7 @@ export const useVectorBucketCreateMutation = ({mutationFn: (vars) => createVectorBucket(vars),async onSuccess(data, variables, context) {const { projectRef } = variables- await queryClient.invalidateQueries(storageKeys.vectorBuckets(projectRef))+ await queryClient.invalidateQueries({ queryKey: storageKeys.vectorBuckets(projectRef) })await onSuccess?.(data, variables, context)},async onError(data, variables, context) {diff --git a/apps/studio/data/storage/vector-bucket-delete-mutation.ts b/apps/studio/data/storage/vector-bucket-delete-mutation.tsindex 2627fb9dd75..88765225d51 100644--- a/apps/studio/data/storage/vector-bucket-delete-mutation.ts+++ b/apps/studio/data/storage/vector-bucket-delete-mutation.ts@@ -40,7 +40,7 @@ export const useVectorBucketDeleteMutation = ({mutationFn: (vars) => deleteVectorBucket(vars),async onSuccess(data, variables, context) {const { projectRef } = variables- await queryClient.invalidateQueries(storageKeys.vectorBuckets(projectRef))+ await queryClient.invalidateQueries({ queryKey: storageKeys.vectorBuckets(projectRef) })await onSuccess?.(data, variables, context)},async onError(data, variables, context) {diff --git a/apps/studio/data/storage/vector-bucket-index-create-mutation.ts b/apps/studio/data/storage/vector-bucket-index-create-mutation.tsindex ed78cbb21fb..f34e7a6dde8 100644--- a/apps/studio/data/storage/vector-bucket-index-create-mutation.ts+++ b/apps/studio/data/storage/vector-bucket-index-create-mutation.ts@@ -52,7 +52,9 @@ export const useVectorBucketIndexCreateMutation = ({mutationFn: (vars) => createVectorBucketIndex(vars),async onSuccess(data, variables, context) {const { projectRef, bucketName } = variables- await queryClient.invalidateQueries(storageKeys.vectorBucketsIndexes(projectRef, bucketName))+ await queryClient.invalidateQueries({+ queryKey: storageKeys.vectorBucketsIndexes(projectRef, bucketName),+ })await onSuccess?.(data, variables, context)},async onError(data, variables, context) {diff --git a/apps/studio/data/storage/vector-bucket-index-delete-mutation.ts b/apps/studio/data/storage/vector-bucket-index-delete-mutation.tsindex 1f3f8514f51..7e95cef493e 100644--- a/apps/studio/data/storage/vector-bucket-index-delete-mutation.ts+++ b/apps/studio/data/storage/vector-bucket-index-delete-mutation.ts@@ -49,7 +49,9 @@ export const useVectorBucketIndexDeleteMutation = ({mutationFn: (vars) => deleteVectorBucketIndex(vars),async onSuccess(data, variables, context) {const { projectRef, bucketName } = variables- await queryClient.invalidateQueries(storageKeys.vectorBucketsIndexes(projectRef, bucketName))+ await queryClient.invalidateQueries({+ queryKey: storageKeys.vectorBucketsIndexes(projectRef, bucketName),+ })await onSuccess?.(data, variables, context)},async onError(data, variables, context) {diff --git a/apps/studio/data/storage/vector-bucket-query.ts b/apps/studio/data/storage/vector-bucket-query.tsindex 7d270036199..2a15fe3cdd5 100644--- a/apps/studio/data/storage/vector-bucket-query.ts+++ b/apps/studio/data/storage/vector-bucket-query.ts@@ -1,10 +1,10 @@-import { useQuery, UseQueryOptions } from '@tanstack/react-query'+import { useQuery } from '@tanstack/react-query'import { components } from 'api-types'import { get, handleError } from 'data/fetchers'import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'import { PROJECT_STATUS } from 'lib/constants'-import type { ResponseError } from 'types'+import type { ResponseError, UseCustomQueryOptions } from 'types'import { storageKeys } from './keys'// [Joshen] JFYI typed incorrectly in API, to fix by adding creationTime to APi@@ -35,7 +35,10 @@ export type VectorBucketError = ResponseErrorexport const useVectorBucketQuery = <TData = VectorBucketData>({ projectRef, vectorBucketName }: VectorBucketVariables,- { enabled = true, ...options }: UseQueryOptions<VectorBucketData, VectorBucketError, TData> = {}+ {+ enabled = true,+ ...options+ }: UseCustomQueryOptions<VectorBucketData, VectorBucketError, TData> = {}) => {const { data: project } = useSelectedProjectQuery()const isActive = project?.status === PROJECT_STATUS.ACTIVE_HEALTHYdiff --git a/apps/studio/data/storage/vector-buckets-indexes-query.ts b/apps/studio/data/storage/vector-buckets-indexes-query.tsindex 16804b1babe..f7a9a03f866 100644--- a/apps/studio/data/storage/vector-buckets-indexes-query.ts+++ b/apps/studio/data/storage/vector-buckets-indexes-query.ts@@ -1,10 +1,10 @@-import { useQuery, UseQueryOptions } from '@tanstack/react-query'+import { useQuery } from '@tanstack/react-query'import { components } from 'api-types'import { get, handleError } from 'data/fetchers'import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'import { PROJECT_STATUS } from 'lib/constants'-import type { ResponseError } from 'types'+import type { ResponseError, UseCustomQueryOptions } from 'types'import { storageKeys } from './keys'export type VectorBucketIndex =@@ -35,7 +35,7 @@ export const useVectorBucketsIndexesQuery = <TData = VectorBucketsIndexesData>({enabled = true,...options- }: UseQueryOptions<VectorBucketsIndexesData, VectorBucketsIndexesError, TData> = {}+ }: UseCustomQueryOptions<VectorBucketsIndexesData, VectorBucketsIndexesError, TData> = {}) => {const { data: project } = useSelectedProjectQuery()const isActive = project?.status === PROJECT_STATUS.ACTIVE_HEALTHYdiff --git a/apps/studio/data/storage/vector-buckets-query.ts b/apps/studio/data/storage/vector-buckets-query.tsindex 79ca60b04e4..031b40d4286 100644--- a/apps/studio/data/storage/vector-buckets-query.ts+++ b/apps/studio/data/storage/vector-buckets-query.ts@@ -1,9 +1,9 @@-import { useQuery, UseQueryOptions } from '@tanstack/react-query'+import { useQuery } from '@tanstack/react-query'import { get, handleError } from 'data/fetchers'import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'import { PROJECT_STATUS } from 'lib/constants'-import type { ResponseError } from 'types'+import type { ResponseError, UseCustomQueryOptions } from 'types'import { storageKeys } from './keys'export type VectorBucketsVariables = { projectRef?: string }@@ -30,7 +30,10 @@ export type VectorBucketsError = ResponseErrorexport const useVectorBucketsQuery = <TData = VectorBucketsData>({ projectRef }: VectorBucketsVariables,- { enabled = true, ...options }: UseQueryOptions<VectorBucketsData, VectorBucketsError, TData> = {}+ {+ enabled = true,+ ...options+ }: UseCustomQueryOptions<VectorBucketsData, VectorBucketsError, TData> = {}) => {const { data: project } = useSelectedProjectQuery()const isActive = project?.status === PROJECT_STATUS.ACTIVE_HEALTHYdiff --git a/apps/studio/pages/project/[ref]/reports/realtime.tsx b/apps/studio/pages/project/[ref]/reports/realtime.tsxindex 79d6920a993..c97f0e918e3 100644--- a/apps/studio/pages/project/[ref]/reports/realtime.tsx+++ b/apps/studio/pages/project/[ref]/reports/realtime.tsx@@ -90,7 +90,9 @@ const RealtimeUsage = () => {if (!selectedDateRange) returnsetIsRefreshing(true)- queryClient.invalidateQueries(['projects', ref, 'report-v2', { queryGroup: 'realtime' }])+ queryClient.invalidateQueries({+ queryKey: ['projects', ref, 'report-v2', { queryGroup: 'realtime' }],+ })refetch()setTimeout(() => setIsRefreshing(false), 1000)}