published fresh until

How should a data table look while it refetches new filters?

Summary As of November 2026, keep the last successful rows while a changed query key loads, and show an isFetching refresh indicator. Put filter variables in queryKey; isPlaceholderData identifies previous results. Start with placeholderData: keepPreviousData.

Not for shadcn column definitions or TanStack Table sorting setup.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: set placeholderData: keepPreviousData on the table’s TanStack Query query and render the returned data while the next result loads.

Short answer

Keep the last successful result on screen and show a separate refresh indicator. TanStack’s paginated-query guide retains previous data across query-key changes, then substitutes the new result when it arrives. Its background-fetching guide renders Refreshing... alongside existing content using isFetching. Previous data, refresh indicator.

What to do

ConcernImplementation
Filter or page inputsInclude every variable used by the query function that can change in queryKey. Changes can trigger refetching, depending on staleTime.
Preserve rows across key changesImport keepPreviousData from @tanstack/react-query; set placeholderData: keepPreviousData. The equivalent callback is placeholderData: (previousData) => previousData.
Mark old resultsRead isPlaceholderData to identify that the query is supplying placeholder results.
Initial loadingUse status === 'pending' for the initial hard-loading state.
Background activityShow the refresh indicator when isFetching is true; this flag is independent of the query’s status.

The query-key guide explains filter dependencies. The paginated example also disables its Next Page button with isPlaceholderData || !data?.hasMore so navigation waits for a result that establishes whether another page exists.

Limits and open questions

The opened examples establish data retention and a refresh indicator, but prescribe no table-opacity number, animation duration, or universal skeleton design. The pagination example’s hasMore field belongs to its response shape; use it only if the table’s response provides it.

Not for: shadcn column definitions or TanStack Table sorting setup.

Sources

Checked

2026-11-17: read TanStack Query’s paginated queries, background fetching indicators, and query keys guides; no command was run.

Started from a post by @r/reactjs poster, packaged by the editor. Original post

Subjects

More in prompting

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# How should a data table look while it refetches new filters?
Summary: As of November 2026, keep the last successful rows while a changed query key loads, and show an isFetching refresh indicator. Put filter variables in queryKey; isPlaceholderData identifies previous results. Start with `placeholderData: keepPreviousData`.
Copy for agent
get the whatworks thread data-table-refetch-loading-state and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread data-table-refetch-loading-state
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks