mirror of
https://github.com/supabase/supabase.git
synced 2026-06-09 03:22:27 +08:00
Fe 1799/consolidate to useselectedprojectquery and (#37684)
* Replace all usage of useProjectContext with useSelectedProjectQuery * Replace all usage of useSelectedProject with useSelectedProjectQuery * Replace all usage of useProjectByRef with useProjectByRefQuery * Replace all usage of useSelectedOrganization with useSelectedOrganizationQuery * Deprecate useSelectedProject, useSelectedOrganization, and useProjectByRef hooks * Deprecate ProjecContext
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import { QueryKey, useQuery, UseQueryOptions } from '@tanstack/react-query'
|
||||
|
||||
import { DEFAULT_PLATFORM_APPLICATION_NAME } from '@supabase/pg-meta/src/constants'
|
||||
import { handleError as handleErrorFetchers, post } from 'data/fetchers'
|
||||
import { useSelectedProject } from 'hooks/misc/useSelectedProject'
|
||||
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
|
||||
import { MB, PROJECT_STATUS } from 'lib/constants'
|
||||
import {
|
||||
ROLE_IMPERSONATION_NO_RESULTS,
|
||||
@@ -9,7 +10,6 @@ import {
|
||||
} from 'lib/role-impersonation'
|
||||
import type { ResponseError } from 'types'
|
||||
import { sqlKeys } from './keys'
|
||||
import { DEFAULT_PLATFORM_APPLICATION_NAME } from '@supabase/pg-meta/src/constants'
|
||||
|
||||
export type ExecuteSqlVariables = {
|
||||
projectRef?: string
|
||||
@@ -159,7 +159,7 @@ export const useExecuteSqlQuery = <TData = ExecuteSqlData>(
|
||||
}: ExecuteSqlVariables,
|
||||
{ enabled = true, ...options }: UseQueryOptions<ExecuteSqlData, ExecuteSqlError, TData> = {}
|
||||
) => {
|
||||
const project = useSelectedProject()
|
||||
const { data: project } = useSelectedProjectQuery()
|
||||
const isActive = project?.status === PROJECT_STATUS.ACTIVE_HEALTHY
|
||||
|
||||
return useQuery<ExecuteSqlData, ExecuteSqlError, TData>(
|
||||
|
||||
Reference in New Issue
Block a user