angular/compose-with-tanstack-query

Compose TanStack Table with TanStack Query for server-driven Angular datagrids.

28.3k|3.6k|Updated Oct 20, 2016
One-click install
npx skills add https://github.com/TanStack/table --skill angular-compose-with-tanstack-query
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: angular/compose-with-tanstack-query
Source: https://github.com/TanStack/table/tree/main/packages/angular-table/skills/angular/compose-with-tanstack-query
Command: npx skills add https://github.com/TanStack/table --skill angular-compose-with-tanstack-query

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prevents slow or flickering server-side datagrid experiences by composing TanStack Table with TanStack Query to fetch, cache, and refetch table data based on controlled pagination, sorting, and filtering state.

Core Features & Use Cases

  • Server-driven data: Use Query to fetch row data from the server while TanStack Table runs in manualPagination/manualSorting/manualFiltering mode.
  • Stable UI during refetches: Use placeholderData with keepPreviousData to avoid the “0 rows flash” between page changes.
  • Correct pagination math: Provide rowCount from the server response so getPageCount() and next/previous button states work under manualPagination.
  • Selection across refetches: Set getRowId to keep row selection stable even when the server returns rows in a new order.
  • Production-ready composition: Hoist table-controlled slices into Angular signals and key the Query on those signal values.

Quick Start

Ask the AI agent to compose an Angular TanStack Table v9 that fetches paginated/sorted/filtered rows via @tanstack/angular-query-experimental using queryKey keyed by pagination/sorting/filter signals and manualPagination/manualSorting/manualFiltering with placeholderData: keepPreviousData.

Frequently Asked Questions about angular/compose-with-tanstack-query

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent UI flicker in Angular tables during server-side pagination refetches?

To prevent UI flicker in Angular tables during server-side pagination, compose TanStack Table with TanStack Query using placeholderData: keepPreviousData. This keeps the previous page visible until new row data arrives, avoiding the 0 rows flash between page changes.

How do I keep row selection stable across server-driven data refetches?

Keep row selection stable across server-driven data refetches by setting getRowId in TanStack Table. This ensures row selection persists even when the server returns rows in a new order after manual sorting or filtering operations.

How does TanStack Query work with manual sorting and filtering in TanStack Table?

TanStack Query works with manual sorting and filtering by running TanStack Table in manualPagination, manualSorting, and manualFiltering modes. You hoist controlled state slices into Angular signals and key the Query on those signal values to fetch remote data accordingly.

Why does pagination math break when using manualPagination in TanStack Table?

Pagination math breaks in manualPagination because the table lacks total row context. Fix this by providing rowCount from the server response, which allows getPageCount() and next/previous button states to calculate correctly under remote data scenarios.

Do I need to include sorting state in the queryKey for Angular remote data fetching?

You need to include all controlled state slices, including sorting, pagination, and filtering states, in the queryKey for Angular remote data fetching. This ensures TanStack Query properly caches and refetches server-driven table data when any state changes.

Can I use TanStack Table with TanStack Query for server-driven Angular datagrids?

You can compose TanStack Table with TanStack Query for server-driven Angular datagrids using @tanstack/angular-query-experimental. This setup fetches, caches, and refetches table data based on controlled pagination, sorting, and filtering state without UI flicker.