Skip to content

fix useTable loading state - #1319

Merged
omeraplak merged 1 commit into
masterfrom
fix-use-table-loading-state
Dec 14, 2021
Merged

fix useTable loading state#1319
omeraplak merged 1 commit into
masterfrom
fix-use-table-loading-state

Conversation

@omeraplak

@omeraplak omeraplak commented Dec 14, 2021

Copy link
Copy Markdown
Contributor

Hey, I'm client! Test me! 'MASTER'
Link to FIX-USE-TABLE-LOADING-STATE

The useTable should show a loading animation based on the isFetching state of react-query. isLoading should only be considered when liveMode is auto.

Closing issues

closes #1316

@refine-bot

Copy link
Copy Markdown
Contributor

Hello from PR Helper

Is your PR ready for review and processing? Mark the PR ready by including #pr-ready in a comment.

If you still have work to do, even after marking this ready. Put the PR on hold by including #pr-onhold in a comment.

@biskuvit biskuvit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@omeraplak
omeraplak merged commit 445baad into master Dec 14, 2021
@omeraplak
omeraplak deleted the fix-use-table-loading-state branch December 14, 2021 07:39
@IgnusG

IgnusG commented Dec 14, 2021

Copy link
Copy Markdown
Contributor

@omeraplak I'd like to suggest a change to this solution if that's ok 🙂

The configured react query hook returns a cached result and re-validates in the Background. Using isFetching here makes this caching strategy not that useful since the dashboard displays the loader until the re-fetch completes (refine will always indicate a cache miss). I think the status could be used here instead. isFetching will switch to true even if the request is cached. status on the other hand will be success if we get a cache hit or loading if the request is not cached yet:

refine-react-query-suggestion

It could look like this (I assume liveMode is not "auto" by default since I don't see isLoading in the react-query details at all):

loading: liveMode === "auto" ? isLoading : status === "loading",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] useTable returns stale result while loading when using pagination

5 participants