Terminal
Terminal/Skill
Guides wiring TanStack Charts to Table, DB, Query and Router so each piece of state has one owner.
By TanStack
Works with
npx skills add tanstack/charts --skill coordinate-charts-with-tanstackRun trigger → inspect → decide → build → verify across the complete product state graph. Assign one owner to each row projection, semantic key, filter, selection, viewport, revision, transaction, and timing policy before connecting libraries.
Record these boundaries before writing adapters:
| Concern | Normal owner | Chart input |
|---|---|---|
| Remote fetching, cache, freshness, retry | Query | resolved semantic snapshot plus status |
| Normalized records, live queries, optimistic transactions | DB or sync collection | keyed projection plus sync state |
| Grid filtering, sorting, grouping, pagination | Table when grid-local; application when shared | explicitly chosen row-model frontier |
| Visual encoding, focus, scene, renderer | Charts | prepared rows and committed behavior options |
| Shared client intent | Store or application state | semantic filters, keys, and domains |
| Restorable navigation state | Router search | validated compact intent, never pixels or row objects |
| Mounted grid window | Virtual | no analytical effect unless “visible rows” is the stated question |
| Burst, queue, or batch policy | Pacer | paced source revisions or committed actions |
| Draft controls and validation | Form or local state | committed, valid intent |
| SSR request and hydration | Start or framework lifecycle | deterministic data revision, locale, and initial geometry |
Fail condition: two libraries can independently change the same semantic state, or the chart receives rows without a named scope and revision.
Do not pass “the rows” between surfaces. Name the analytical frontier:
sourceRows: canonical records available to this client.eligibleRows: records after shared business filters.summaryRows: chart grain after aggregation or binning.detailRows: grid grain before presentation-only sorting or pagination.visibleRows: currently mounted virtual items; usually presentation only.selectedRows: rows resolved from stable semantic keys.Document whether grid sorting, filtering, grouping, pagination, or selection changes the chart question. Use the Table and data-grid reference for row-model choices.
Use one semantic projection owner, then expose separate summary and detail outputs:
const analysis = projectOrders(sourceRows, sharedIntent)
const tableData = analysis.detailRows
const chartDefinition = defineChart({
marks: [
lineY(analysis.summaryRows, {
x: 'day',
y: 'revenue',
color: 'region',
key: ({ datum }) => `${datum.region}:${datum.day.toISOString()}`,
}),
],
scales: {
x: { scale: scaleUtc },
y: { scale: scaleLinear },
},
})
Do not independently restate eligibility, aggregation, or metric formulas in Table accessors and chart transforms. Presentation-only table sort and pagination may remain grid-owned.
Share values such as:
Keep DOM nodes, row indexes, chart pixels, virtual indexes, tooltip bodies, and Table row objects inside their owning surface.
Use three phases where interaction can write data:
Do not write every pointer frame to Router, Query, a sync engine, or a database transaction. Read Query, DB, and sync when records are live or writable.
Choose timing by semantics:
Do not add a second scheduler around work already bounded by the chart host, live-query engine, or framework.
Wrong: feed the chart whatever rows the grid currently renders.
Correct: choose the filtered, grouped, pre-pagination, page, or selected frontier because it matches the stated comparison.
Table row models can include sorting, grouping, expansion, and pagination. The final grid row model is a presentation result, not an automatically valid analytical dataset.
Source: TanStack Table row-model guide
Wrong: synchronize row.index, array position, or virtual item index.
Correct: define an application-level entity or aggregate key and adapt both Table and Charts to it.
Indexes change under sorting, filtering, pagination, streaming, and virtualization. Grouped Table row IDs may also contain presentation suffixes.
Source: TanStack Table rows guide; API-FRICTION.md F-120, F-131, and F-239
Wrong: implement the KPI in a Table aggregation function and again in chart preparation.
Correct: derive one named semantic projection that can feed the grid, chart, table alternative, export, and tests.
Independent pipelines drift on null policy, denominators, time boundaries, and later product changes.
Source: docs/guides/transforms-and-reactivity.md; API-FRICTION.md F-128 and F-163
Wrong: chart selection sets a Table filter whose change recreates chart selection and writes the URL again.
Correct: assign one owner, normalize one event into semantic intent, and let every surface derive from that state without echoing equivalent updates.
Feedback loops cause redundant renders, history spam, flicker, and state that cannot settle.
Source: Charts interaction ownership; TanStack Router search-state guidance
Wrong: animate an optimistic mutation into the ordinary historical series with no pending state.
Correct: carry sync or transaction status into the semantic projection, differentiate pending values when decision-relevant, and verify rollback.
TanStack DB applies optimistic state before persistence and can replace or roll it back after synchronization.
Source: TanStack DB mutations and live-query guides
Wrong: write every brush, handle, resize, or pointer update through Router, Query invalidation, or a sync transaction.
Correct: preview locally, pace expensive derivation if necessary, and commit one semantic value at the interaction boundary.
Frame-rate state is presentation. Persistence needs validation, cancellation, ordering, and conflict semantics.
Source: Charts interaction guides; TanStack Pacer timing guidance
Wrong: chart only mounted grid rows because Virtual currently exposes them.
Correct: chart the intended source or filtered projection; use mounted rows only for an explicitly viewport-scoped question.
Virtual controls render work, not dataset meaning.
Source: TanStack Virtual virtualizer reference
See also: prepare-chart-data/SKILL.md, build-chart-interactions/SKILL.md, update-and-animate-charts/SKILL.md, and debug-and-verify-charts/SKILL.md.