Skip to content

usePaginatedQuery sometimes returns status = loading, data = undefined after initial query #169

@jiafra

Description

@jiafra

I'm updating our app to 1.x, and I've noticed an issue with usePaginatedQuery. I'm using it within the context of a filter, as you type it re-queries, however if I really go at it on my keyboard, sometimes I get a blip of status = loading. I was able to make it disappear by adding the following check:

if (typeof latestData !== 'undefined' && status === 'success') {
  lastDataRef.current = latestData;
}

at

https://github.com/tannerlinsley/react-query/blob/b1b9ddc4961f029837ffc7b3c19af13ea3f040e1/src/usePaginatedQuery.js#L23-L25

I don't have much insight into the lib, but maybe this could help

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions