DieMantraD
Convex Community4mo ago
5 replies
DieMantra

usePaginatedQuery results are odd when "skipped"

I just noticed that my paginated results are indefinitely loading when I pass the "skip" as the argument... I am not sure if this a bug or if its the expected behaviour.

interface GetPaginatedCampaignsQueryArgs {
    branchId?: Id<'branches'> | null;
    status?:
        | 'all'
        | 'active'
        | 'under offer'
        | 'sold'
        | 'leased'
        | 'withdrawn'
        | 'cancelled'
        | null;
    initialNumItems: number;
}
export const getPaginatedCampaignsQuery = (args: GetPaginatedCampaignsQueryArgs) =>
    usePaginatedQuery(
        api.campaigns.agency.queries.getCampaignsQuery,
        args.branchId
            ? { branchId: args.branchId, status: args.status || undefined }
            : 'skip',
        { initialNumItems: args.initialNumItems }
    );

When skipped I get this result:
{
    "results": [],
    "status": "LoadingFirstPage",
    "isLoading": true
}

I assumed that if 'skip' was passed in, and the query is skipped, it would return isLoading: false, or something like that.
Was this page helpful?