mirror of
https://github.com/supabase/supabase.git
synced 2026-05-31 01:42:45 +08:00
chore: xmas cleanup (#19938)
This commit is contained in:
@@ -1,11 +1,4 @@
|
||||
import {
|
||||
QueryClient,
|
||||
QueryKey,
|
||||
useQuery,
|
||||
useQueryClient,
|
||||
UseQueryOptions,
|
||||
} from '@tanstack/react-query'
|
||||
import { useCallback } from 'react'
|
||||
import { QueryClient, QueryKey, useQuery, UseQueryOptions } from '@tanstack/react-query'
|
||||
|
||||
import { post } from 'data/fetchers'
|
||||
import {
|
||||
@@ -138,36 +131,3 @@ export const prefetchExecuteSql = (
|
||||
executeSql({ projectRef, connectionString, sql, queryKey, handleError }, signal)
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* useExecuteSqlPrefetch is used for prefetching a SQL query. For example, starting a query loading before a page is navigated to.
|
||||
*
|
||||
* @example
|
||||
* const prefetch = useExecuteSqlPrefetch()
|
||||
*
|
||||
* return (
|
||||
* <Link onMouseEnter={() => prefetch({ ...args })}>
|
||||
* Start loading on hover
|
||||
* </Link>
|
||||
* )
|
||||
*/
|
||||
export const useExecuteSqlPrefetch = () => {
|
||||
const client = useQueryClient()
|
||||
|
||||
return useCallback(
|
||||
({ projectRef, connectionString, sql, queryKey, handleError }: ExecuteSqlVariables) => {
|
||||
if (projectRef) {
|
||||
return prefetchExecuteSql(client, {
|
||||
projectRef,
|
||||
connectionString,
|
||||
sql,
|
||||
queryKey,
|
||||
handleError,
|
||||
})
|
||||
}
|
||||
|
||||
return Promise.resolve()
|
||||
},
|
||||
[client]
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user