- Consolidated duplicate UndoManagers to single instance - Fixed connection promise to only resolve on 'connected' status - Fixed WebSocketProvider import (WebsocketProvider) - Added proper doc.destroy() cleanup - Renamed isPresenceInitialized property to avoid conflict Co-Authored-By: Paperclip <noreply@paperclip.ing>
77 lines
1.9 KiB
TypeScript
77 lines
1.9 KiB
TypeScript
import { InfiniteQueryObserver } from '@tanstack/query-core'
|
|
import { createMemo } from 'solid-js'
|
|
import { useBaseQuery } from './useBaseQuery'
|
|
import type {
|
|
DefaultError,
|
|
InfiniteData,
|
|
QueryKey,
|
|
QueryObserver,
|
|
} from '@tanstack/query-core'
|
|
import type { QueryClient } from './QueryClient'
|
|
import type {
|
|
DefinedUseInfiniteQueryResult,
|
|
UseInfiniteQueryOptions,
|
|
UseInfiniteQueryResult,
|
|
} from './types'
|
|
import type { Accessor } from 'solid-js'
|
|
import type {
|
|
DefinedInitialDataInfiniteOptions,
|
|
UndefinedInitialDataInfiniteOptions,
|
|
} from './infiniteQueryOptions'
|
|
|
|
export function useInfiniteQuery<
|
|
TQueryFnData,
|
|
TError = DefaultError,
|
|
TData = InfiniteData<TQueryFnData>,
|
|
TQueryKey extends QueryKey = QueryKey,
|
|
TPageParam = unknown,
|
|
>(
|
|
options: DefinedInitialDataInfiniteOptions<
|
|
TQueryFnData,
|
|
TError,
|
|
TData,
|
|
TQueryKey,
|
|
TPageParam
|
|
>,
|
|
queryClient?: Accessor<QueryClient>,
|
|
): DefinedUseInfiniteQueryResult<TData, TError>
|
|
export function useInfiniteQuery<
|
|
TQueryFnData,
|
|
TError = DefaultError,
|
|
TData = InfiniteData<TQueryFnData>,
|
|
TQueryKey extends QueryKey = QueryKey,
|
|
TPageParam = unknown,
|
|
>(
|
|
options: UndefinedInitialDataInfiniteOptions<
|
|
TQueryFnData,
|
|
TError,
|
|
TData,
|
|
TQueryKey,
|
|
TPageParam
|
|
>,
|
|
queryClient?: Accessor<QueryClient>,
|
|
): UseInfiniteQueryResult<TData, TError>
|
|
|
|
export function useInfiniteQuery<
|
|
TQueryFnData,
|
|
TError = DefaultError,
|
|
TData = InfiniteData<TQueryFnData>,
|
|
TQueryKey extends QueryKey = QueryKey,
|
|
TPageParam = unknown,
|
|
>(
|
|
options: UseInfiniteQueryOptions<
|
|
TQueryFnData,
|
|
TError,
|
|
TData,
|
|
TQueryKey,
|
|
TPageParam
|
|
>,
|
|
queryClient?: Accessor<QueryClient>,
|
|
): UseInfiniteQueryResult<TData, TError> {
|
|
return useBaseQuery(
|
|
createMemo(() => options()),
|
|
InfiniteQueryObserver as typeof QueryObserver,
|
|
queryClient,
|
|
) as UseInfiniteQueryResult<TData, TError>
|
|
}
|