Table of Contents

Interface IInfiniteQuery<TArgs, TData, TPageParam>

Namespace
DotNetQuery.Core
Assembly
DotNetQuery.Core.dll

An infinite (paginated) query that accumulates pages of TData fetched with page parameters of type TPageParam.

public interface IInfiniteQuery<TArgs, TData, TPageParam> : IQuery, IDisposable where TData : class

Type Parameters

TArgs

The type of the arguments that identify which resource to fetch.

TData

The type of a single page of data. Constrained to reference types because the library uses null to represent "no data yet" — a non-nullable value type has no way to express that.

TPageParam

The type of the page parameter (cursor/offset).

Inherited Members

Properties

CurrentState

The current state snapshot. Can be read synchronously without subscribing.

InfiniteQueryState<TData, TPageParam> CurrentState { get; }

Property Value

InfiniteQueryState<TData, TPageParam>

Failure

Emits the Exception on each failed fetch.

IObservable<Exception> Failure { get; }

Property Value

IObservable<Exception>

Settled

Emits the final state after each fetch completes, regardless of success or failure.

IObservable<InfiniteQueryState<TData, TPageParam>> Settled { get; }

Property Value

IObservable<InfiniteQueryState<TData, TPageParam>>

State

Emits on every state transition. Replays the latest state to new subscribers.

IObservable<InfiniteQueryState<TData, TPageParam>> State { get; }

Property Value

IObservable<InfiniteQueryState<TData, TPageParam>>

Success

Emits the full accumulated page list after each fetch fully settles — not during IsFetchingNextPage or IsFetchingPreviousPage. Re-emissions are suppressed when every page equals the previous emission according to DataComparer.

IObservable<IReadOnlyList<TData>> Success { get; }

Property Value

IObservable<IReadOnlyList<TData>>

Methods

Detach()

Removes this query from the client cache while keeping active subscriptions alive. Use Dispose() to also tear down all subscriptions and release resources.

void Detach()

FetchNextPage()

Fetches the next page using the cursor derived from the last loaded page via GetNextPageParam. No-op when no pages are loaded yet or HasNextPage is false.

void FetchNextPage()

FetchPreviousPage()

Fetches the previous page using the cursor derived from the first loaded page via GetPreviousPageParam. No-op when no pages are loaded yet, HasPreviousPage is false, or no GetPreviousPageParam was configured.

void FetchPreviousPage()

SetArgs(TArgs)

Sets the args that drive the cache key and fetching. When args change, the query switches to the cache entry for the newly derived key and triggers a fetch if the query is enabled.

void SetArgs(TArgs args)

Parameters

args TArgs

SetEnabled(bool)

Enables or disables the query. When false, fetching is suspended even if the query is invalidated or new args are pushed. Pass true to resume.

void SetEnabled(bool enabled)

Parameters

enabled bool