chore: xmas cleanup (#19938)

This commit is contained in:
Kevin Grüneberg
2024-01-04 17:27:49 +01:00
committed by GitHub
parent 29bc6f78ec
commit d12332ea5a
168 changed files with 132 additions and 3009 deletions

View File

@@ -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]
)
}