preact/compose-with-tanstack-pacer

Debounce filter and throttle column resize writes in Preact TanStack Table.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @tanstack/preact-pacer.

What problem does it solve?

It prevents interactive Preact tables from becoming janky when filter typing or column resizing triggers too many expensive row-model recomputations.

Core Features & Use Cases

  • Debounced filter writes: Debounce column.setFilterValue (and optionally global filtering) so the table recomputes on the trailing edge instead of every keystroke.
  • Throttled resize writes: Throttle table.setColumnSizing updates during pointer-move so resizing stays responsive without rerunning the full layout every pixel.
  • Correct interaction pattern: Keep immediate UI responsiveness with local state while debouncing only the write to the table.

Quick Start

Install @tanstack/preact-pacer and wrap your filter input updates with useDebouncedCallback and your resize updates with useThrottledCallback so table recomputation happens less frequently while the UI remains smooth.

Frequently Asked Questions about preact/compose-with-tanstack-pacer

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

FAQPage Schema
How do I debounce filter inputs in a Preact table to stop lag during typing?

To debounce filter inputs in a Preact table, wrap column.setFilterValue with useDebouncedCallback from @tanstack/preact-pacer. This delays the table row-model recomputation until typing stops, keeping local UI state responsive while preventing janky renders.

Why does column resizing cause performance issues in TanStack Table for Preact?

Column resizing causes performance issues because pointer-move events trigger continuous table.setColumnSizing updates, forcing expensive layout recomputations on every pixel. Throttling these writes limits the recomputation frequency, maintaining smooth visual feedback without overloading the render cycle.

What is the best way to throttle column resizing updates in a Preact datagrid?

The best way to throttle column resizing is using useThrottledCallback from @tanstack/preact-pacer on table.setColumnSizing. This restricts the expensive row-model recomputations to fixed intervals during pointer-move events, keeping table resizing responsive without rerunning layout every pixel.

Can I use @tanstack/preact-pacer to improve filtering performance without losing immediate UI feedback?

Yes, you can use @tanstack/preact-pacer to improve filtering performance without losing feedback by keeping local UI state for immediate visual updates while exclusively debouncing the write path to column.setFilterValue, ensuring the heavy row-model recomputation only runs on the trailing edge.

When should I debounce versus throttle writes in interactive Preact tables?

Debounce writes for high-frequency text input scenarios like filtering so recomputations run only after typing pauses. Throttle writes for continuous pointer-driven actions like column resizing so row-model updates occur at controlled intervals, preventing layout thrashing while dragging.