Skip to content
Source
Sign inSign up
TanStack/query

isLoading is not changing to true when placeholderData: keepPreviousData is set #9431

Closednodirbekprogrammer(GitHub profile, opens in a new tab) opened this issue 1 comment

Describe the bug

This is happening with MUI DataGrid pagination. If I set isFetching for the loading state of the table, as shown in the docs, it keeps loading even when I go back, even if the data is already in the cache, which is very annoying.

Your minimal, reproducible example

I'm not lying

Steps to reproduce

Even with placeholderData: keepPreviousData set, isLoading should work as usual.

Expected behavior

I want to load table only when fetching fresh data.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

mac, chrome

Tanstack Query adapter

react-query

TanStack Query version

5.72.0

TypeScript version

5.8.2

Additional context

No response

  1. TkDodocommented

    you want to use isPending.

    The example uses isLoading for a background loading indicator that is displayed alongside data, not a hard loading state.

  2. TkDodo closed this

  3. TkDodo added labelsworks as designed

Sign in to join this conversation.