Interface UseInfiniteSubscriptionOptions<TSubscriptionFnData, TError, TData, TSubscriptionKey>

Type Parameters

  • TSubscriptionFnData = unknown

  • TError = Error

  • TData = TSubscriptionFnData

  • TSubscriptionKey extends QueryKey = QueryKey

Hierarchy

  • UseInfiniteSubscriptionOptions

Properties

enabled?: boolean

Set this to false to disable automatic resubscribing when the subscription mounts or changes subscription keys. To refetch the subscription, use the refetch method returned from the useSubscription instance. Defaults to true.

getNextPageParam?: GetNextPageParamFunction<TSubscriptionFnData>

This function can be set to automatically get the next cursor for infinite queries. The result will also be used to determine the value of hasNextPage.

getPreviousPageParam?: GetPreviousPageParamFunction<TSubscriptionFnData>

This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of hasPreviousPage.

onData?: ((data: InfiniteData<TData>) => void)

Type declaration

    • (data: InfiniteData<TData>): void
    • This function will fire any time the subscription successfully fetches new data or the cache is updated via setQueryData.

      Parameters

      • data: InfiniteData<TData>

      Returns void

onError?: ((error: TError) => void)

Type declaration

    • (error: TError): void
    • This callback will fire if the subscription encounters an error and will be passed the error.

      Parameters

      • error: TError

      Returns void

placeholderData?: InfiniteData<TSubscriptionFnData> | PlaceholderDataFunction<InfiniteData<TSubscriptionFnData>>

If set, this value will be used as the placeholder data for this particular query observer while the subscription is still in the loading data and no initialData has been provided.

retry?: RetryValue<TError>

If false, failed subscriptions will not retry by default. If true, failed subscriptions will retry infinitely. If set to an integer number, e.g. 3, failed subscriptions will retry until the failed subscription count meets that number. If set to a function (failureCount: number, error: TError) => boolean failed subscriptions will retry until the function returns false.

retryDelay?: RetryDelayValue<TError>

If number, applies delay before next attempt in milliseconds. If function, it receives a retryAttempt integer and the actual Error and returns the delay to apply before the next attempt in milliseconds.

See

https://react-query.tanstack.com/reference/useQuery

retryOnMount?: boolean

If set to false, the subscription will not be retried on mount if it contains an error. Defaults to true.

select?: ((data: InfiniteData<TSubscriptionFnData>) => InfiniteData<TData>)

Type declaration

    • (data: InfiniteData<TSubscriptionFnData>): InfiniteData<TData>
    • This option can be used to transform or select a part of the data returned by the query function.

      Parameters

      • data: InfiniteData<TSubscriptionFnData>

      Returns InfiniteData<TData>

Generated using TypeDoc