Skip to content

feat(Table): plugins get an immutable row and render context; useTableRowIndex numbers from it - #10171

Merged
cixzhang merged 5 commits into
mainfrom
lane4/table-row-context
Nov 7, 2026
Merged

cixzhang merged 5 commits into
mainfrom
lane4/table-row-context

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

User impact

A table plugin that needs a row's position, such as row numbering or position-based formatting, had no way to get it in a cell. useTableRowIndex had to take the rendered data array and rebuild an item → index map on every data change, and callers had to pass data (and sometimes getRowKey) only to recover something Table already knows. Now Table gives every body row and cell transform an immutable TableRowContext. useTableRowIndex() numbers rows with no data argument (a passed data still orders the numbers), and rows that move re-render only for plugins that actually read the index.

Closes #3940. Split from #8280: the TableRowContext / TableRenderContext piece only, with attribution to Humberto Virtudes.

Current specification

component:Table (current):

  • FR17: Table supplies immutable TableRowContext and TableRenderContext rather than requiring module extractors or DOM mode inference. First-party useTableSelection and useTableStickyColumns declare rowModel: 'flat'.
  • The "Transform context" API row and its prose: these define the fields. Row context: key, identityStatus, kind, zero-based logicalIndex, logicalRowCount, headerRowCount, render. Render context: mode, admitted row model, logical and header counts, and a stable parent-owned viewport reference. The context reaches transforms as an optional fourth row-transform, sixth cell-transform and second wrapper-transform argument.
  • FR20: "Visible numbering derives i+1 from the same zero-based index."

Change

  • Types (types.ts, exported from the Table entry):

  • BaseTable:

    • builds one frozen render context per render (mode, rowModel, logicalRowCount, headerRowCount, viewport) and one frozen row context per mounted row;
    • passes them to the transforms;
    • attaches the viewport ref to the scroll wrapper, merged with any plugin ref.
  • Row model: the first non-flat declaration wins. A body transform with no declaration makes the model custom, and kind is product only for flat.

  • Identity: no plugin here opts into canonical identity, so key is the row's existing key (its idKey value, or its index) and identityStatus is valid. Canonical identity checking stays with the windowing and activation work.

  • Memoization (tableRowContextUsage.ts, adapted from feat(Table): window fixed-height flat tables through useTableRowsVirtualization #8280):

    • each plugin sees a tracked copy of the context whose getters record reads of logicalIndex and the row count;
    • a moved row re-renders only for a plugin that has a row transform or has read the index;
    • a changed row count re-renders rows only for a plugin that has read a count.

    Without this, every table with selection would re-render all rows on each re-sort.

  • Late reads: tracking sees only reads made while the transform runs. So TableRowContext and the body transforms say to read values during the transform and copy what a returned callback needs. A tracked getter read after its plugin's transform returned warns once in development, because a memoized row keeps its old context.

  • Declarations: useTableSelection, useTableStickyColumns and useTableRowIndex declare rowModel: 'flat'. Plugin validation accepts rowModel.

  • useTableRowIndex:

    • its own cell transform stores context.logicalIndex for the row, and its column's renderCell shows logicalIndex + startFrom. Table runs a row's cell transforms before it renders that row's cells.
    • data/getRowKey become optional. Without them, numbers come from the row context. A caller who passes data (a grouped table with its ungrouped rows, or a subset view) keeps numbering from that array, so legacy configuration continues.
    • There's no new public API: no renderCell signature change and no content slot.
  • Not carried: windowing, aria-rowcount changes, row status, activation, whole-row owners and canonical-identity admission. Those stay in feat(Table): window fixed-height flat tables through useTableRowsVirtualization #8280, feat(Table): add controlled row activation #8281 and feat(table): add useTableActivation row-activation plugin #8861.

  • Story and CLI block: the numbered-rows story and the CLI block call useTableRowIndex() without data.

  • Record: component:Table gets an FR17 verification row and two verified_by entries.

  • API report: packages/core/api-report.md shows only this PR's rows: the two context interfaces, the TablePlugin changes, and useTableRowIndex's optional config and data. A full regeneration on this base also picks up chore(core): regenerate the API report for the component icon slots and Item states #10153's still-unmerged component-icon and Item-state rows plus unrelated drift, so those rows are left to chore(core): regenerate the API report for the component icon slots and Item states #10153.

Evidence

  • Red first: the new TableRowContext.test.tsx and the new useTableRowIndex case fail on main (7 of 7). They cover:
    • contexts for rows and cells (key, index, counts, frozen);
    • index keys without idKey;
    • custom and declared row models;
    • the wrapper context, whose viewport is the element around the <table>;
    • a re-sort that re-renders rows for an index-reading plugin and not for a non-reading one;
    • an appended row re-rendering for a count reader;
    • numbering without data across a re-sort;
    • a passed data still ordering the numbers in a subset view.
  • Callbacks: a callback that copied the index during the transform reports the current position after a re-sort. A callback that reads it later warns.
  • Suites: all Table suites pass (681), including the existing useTableRowIndex cases with data.
  • Checks: the core tsc, the core build, check:knowledge, check:sync and check:changesets pass.

Writing rubric results

Record touched: component:Table (one verification-map row and verified_by).

  • R1 narration: none; the row states what the tests cover.
  • R2 research: none.
  • R3 evidence: the row names the tests and their cases.
  • R4 rejected alternatives: none.
  • R5 change references: none.
  • R6 open questions: none touched.

cixzhang and others added 2 commits November 5, 2026 14:31
…t; useTableRowIndex numbers from it (red)

Co-authored-by: Humberto Virtudes <[email protected]>
… TableRowContext / TableRenderContext; useTableRowIndex numbers from it

Table builds one frozen render context per render and one frozen row context
per mounted row, and passes them as the optional last transform argument. A
plugin declares rowModel; selection, sticky columns and row index declare
'flat'. Per-plugin tracked contexts record index and count reads, so a moved
row re-renders only for a plugin that reads its index. useTableRowIndex
numbers from logicalIndex through its own cell transform; data is optional.

Split from #8280 (the transform-context piece only).

Co-authored-by: Humberto Virtudes <[email protected]>
@vercel

vercel Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 6, 2026 12:30am UTC

Request Review

@astracat-bot

astracat-bot Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 7, 2026, 2:52 PM UTC

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 5, 2026
@cixzhang

cixzhang commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec a37b00d

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 1f0cbd3

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
TableBody 3.5 kB (not measured) · 3.3 kB CSS (not measured) — ✓ · ✓ · ✗
TableFooter 3.5 kB (not measured) · 3.3 kB CSS (not measured) — ✓ · ✓ · ✗
TableHeader 3.5 kB (not measured) · 3.3 kB CSS (not measured) — ✓ · ✓ · ✗
8 more components
Component Size LoC Visual · A11y · RTL
TableRow 6.7 kB (not measured) · 3.9 kB CSS (not measured) — ✓ · ✓ · ✗
Markdown 160.3 kB (not measured) · 19.3 kB CSS (not measured) — — · — · —
Table 98.5 kB (not measured) · 17.1 kB CSS (not measured) — ✓ · ✓ · —
TableCell 89.7 kB (not measured) · 16.8 kB CSS (not measured) — ✓ · ✓ · ✓
TableHeaderCell 89.3 kB (not measured) · 16.6 kB CSS (not measured) — ✓ · ✓ · ✓
TableSelectionToolbar 60.2 kB (not measured) · 11.9 kB CSS (not measured) — ✓ · ✓ · ✓
lab/Comments 280.5 kB (not measured) · 2.5 kB CSS (not measured) — — · — · —
lab/CommentThread 274.7 kB (not measured) · 2.4 kB CSS (not measured) — — · — · —

Package size: measured; main has no measurement of the merge base to compare yet.

API changes: cli +14 · ~5 · −0 (against the merge base's committed report); core +20 · ~13 · −0 (against the merge base's committed report)

Committed API report behind this build: cli 19 rows, core 31 rows; run pnpm api:report.

52 API changes (advisory)
Package Where Signature Usage
+ cli ./api · Types · type SearchResultEntry deprecated?: ComponentDeprecation | undefined import type {SearchResultEntry} from '@astryxdesign/cli/api'; const x: SearchResultEntry = {deprecated: …}
+ cli ./authoring · Types · interface ComponentDeprecation interface ComponentDeprecation import type {ComponentDeprecation} from '@astryxdesign/cli/authoring'
+ cli ./authoring · Types · interface ComponentIconSlotDoc interface ComponentIconSlotDoc import type {ComponentIconSlotDoc} from '@astryxdesign/cli/authoring'
+ cli ./authoring · Types · interface ComponentIconSlotStateDoc interface ComponentIconSlotStateDoc import type {ComponentIconSlotStateDoc} from '@astryxdesign/cli/authoring'
+ cli ./authoring · Types · interface MultiComponentDoc deprecated?: ComponentDeprecation import type {MultiComponentDoc} from '@astryxdesign/cli/authoring'; const x: MultiComponentDoc = {deprecated: …}
+ cli ./authoring · Types · interface SingleComponentDoc deprecated?: ComponentDeprecation import type {SingleComponentDoc} from '@astryxdesign/cli/authoring'; const x: SingleComponentDoc = {deprecated: …}
+ cli ./doc · Types · interface ComponentBaseDoc deprecated?: ComponentDeprecation import type {ComponentBaseDoc} from '@astryxdesign/cli/doc'; const x: ComponentBaseDoc = {deprecated: …}
+ cli ./doc · Types · interface SubComponentDoc deprecated?: ComponentDeprecation import type {SubComponentDoc} from '@astryxdesign/cli/doc'; const x: SubComponentDoc = {deprecated: …}
+ cli ./doc · Also exported from an earlier entry point · ComponentDeprecation ComponentDeprecation (./authoring) import {ComponentDeprecation} from '@astryxdesign/cli/doc'
+ cli ./doc · Also exported from an earlier entry point · ComponentIconSlotDoc ComponentIconSlotDoc (./authoring) import {ComponentIconSlotDoc} from '@astryxdesign/cli/doc'
+ cli ./doc · Also exported from an earlier entry point · ComponentIconSlotStateDoc ComponentIconSlotStateDoc (./authoring) import {ComponentIconSlotStateDoc} from '@astryxdesign/cli/doc'
+ cli ./template · Also exported from an earlier entry point · ComponentDeprecation ComponentDeprecation (./authoring) import {ComponentDeprecation} from '@astryxdesign/cli/template'
+ cli ./template · Also exported from an earlier entry point · ComponentIconSlotDoc ComponentIconSlotDoc (./authoring) import {ComponentIconSlotDoc} from '@astryxdesign/cli/template'
+ cli ./template · Also exported from an earlier entry point · ComponentIconSlotStateDoc ComponentIconSlotStateDoc (./authoring) import {ComponentIconSlotStateDoc} from '@astryxdesign/cli/template'
~ cli ./api · Functions · function search function search: (query: string, options?: { cwd?: string | undefined; type?: "template" | "component" | "hook" | "theme" | "doc" | undefined; limit?: number | undefined }) => Promise<SearchResponse> → function search: (query: string, options?: { cwd?: string | undefined; type?: "template" | "component" | "doc" | "theme" | "hook" | undefined; limit?: number | undefined }) => Promise<SearchResponse> import {search} from '@astryxdesign/cli/api'; search(…)
~ cli ./authoring · Types · interface MultiComponentDoc theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } import type {MultiComponentDoc} from '@astryxdesign/cli/authoring'; const x: MultiComponentDoc = {theming: …}
~ cli ./authoring · Types · interface SingleComponentDoc theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } import type {SingleComponentDoc} from '@astryxdesign/cli/authoring'; const x: SingleComponentDoc = {theming: …}
~ cli ./doc · Types · interface ComponentBaseDoc theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } import type {ComponentBaseDoc} from '@astryxdesign/cli/doc'; const x: ComponentBaseDoc = {theming: …}
~ cli ./doc · Types · interface SubComponentDoc theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } import type {SubComponentDoc} from '@astryxdesign/cli/doc'; const x: SubComponentDoc = {theming: …}
+ core . · Types · type ComponentIconMap type ComponentIconMap<Variant extends string = IconVariant> = { [Slot in ComponentIconSlotName]?: ComponentIconSlotMap[Slot] extends true ? IconName | null | ComponentIconRequest<Variant> : ComponentIconValue<ComponentIconSlotMap[Slot], Variant> } import type {ComponentIconMap} from '@astryxdesign/core'
+ core . · Types · type ComponentIconRequest type ComponentIconRequest<Variant extends string = IconVariant> = Readonly<{ icon?: IconName | null; variant?: Variant; size?: IconSize }> import type {ComponentIconRequest} from '@astryxdesign/core'
+ core . · Types · interface ComponentIconSlotMap interface ComponentIconSlotMap import type {ComponentIconSlotMap} from '@astryxdesign/core'
+ core . · Types · type ComponentIconSlotName type ComponentIconSlotName = keyof ComponentIconSlotMap & string import type {ComponentIconSlotName} from '@astryxdesign/core'
+ core . · Types · type ComponentIconStaticMap type ComponentIconStaticMap = Partial<Record<ComponentIconSlotName, IconName | null | ComponentIconRequest<string>>> import type {ComponentIconStaticMap} from '@astryxdesign/core'
+ core . · Types · type ComponentIconValue type ComponentIconValue<State, Variant extends string = IconVariant> = IconName | null | ComponentIconRequest<Variant> | ((state: Readonly<State>) => ComponentIconRequest<Variant> | null | undefined) import type {ComponentIconValue} from '@astryxdesign/core'
+ core . · Types · interface DefineThemeInput componentIcons?: ComponentIconMap<ThemeIconEntryVariant<IconVariants, Base>> import type {DefineThemeInput} from '@astryxdesign/core'; const x: DefineThemeInput = {componentIcons: …}
+ core . · Types · interface DefinedTheme __componentIcons?: Partial<Record<string, StoredComponentIconValue>> @internal import type {DefinedTheme} from '@astryxdesign/core'; const x: DefinedTheme = {__componentIcons: …}
+ core . · Types · interface DefinedTheme componentIcons?: ComponentIconStaticMap import type {DefinedTheme} from '@astryxdesign/core'; const x: DefinedTheme = {componentIcons: …}
+ core . · Types · interface TablePlugin rowModel?: TableRenderContext['rowModel'] import type {TablePlugin} from '@astryxdesign/core'; const x: TablePlugin = {rowModel: …}
+ core . · Types · interface TableRenderContext interface TableRenderContext import type {TableRenderContext} from '@astryxdesign/core'
+ core . · Types · interface TableRowContext interface TableRowContext import type {TableRowContext} from '@astryxdesign/core'
+ core ./Icon · Also exported from an earlier entry point · ComponentIconMap ComponentIconMap (.) import {ComponentIconMap} from '@astryxdesign/core/Icon'
+ core ./Icon · Also exported from an earlier entry point · ComponentIconRequest ComponentIconRequest (.) import {ComponentIconRequest} from '@astryxdesign/core/Icon'
+ core ./Icon · Also exported from an earlier entry point · ComponentIconSlotMap ComponentIconSlotMap (.) import {ComponentIconSlotMap} from '@astryxdesign/core/Icon'
+ core ./Icon · Also exported from an earlier entry point · ComponentIconSlotName ComponentIconSlotName (.) import {ComponentIconSlotName} from '@astryxdesign/core/Icon'
+ core ./Icon · Also exported from an earlier entry point · ComponentIconStaticMap ComponentIconStaticMap (.) import {ComponentIconStaticMap} from '@astryxdesign/core/Icon'
+ core ./Icon · Also exported from an earlier entry point · ComponentIconValue ComponentIconValue (.) import {ComponentIconValue} from '@astryxdesign/core/Icon'
+ core ./Table · Also exported from an earlier entry point · TableRenderContext TableRenderContext (.) import {TableRenderContext} from '@astryxdesign/core/Table'
+ core ./Table · Also exported from an earlier entry point · TableRowContext TableRowContext (.) import {TableRowContext} from '@astryxdesign/core/Table'
~ core . · Hooks · hook useClickableContainer hook useClickableContainer: ({…}: UseClickableContainerOptions) => ClickableContainerResult → hook useClickableContainer: (options: UseClickableContainerOptions) => ClickableContainerResult import {useClickableContainer} from '@astryxdesign/core'; useClickableContainer(…)
~ core . · Hooks · hook useTableRowIndex hook useTableRowIndex: <T extends Record<string, unknown>>(config: UseTableRowIndexConfig<T>) => TablePlugin<T> → hook useTableRowIndex: <T extends Record<string, unknown>>(config?: UseTableRowIndexConfig<T>) => TablePlugin<T> import {useTableRowIndex} from '@astryxdesign/core'; useTableRowIndex(…)
~ core . · Values · const colorVars const colorVars: stylex.VarGroup<Readonly<{ readonly '--color-accent': "light-dark(#0064E0, #0171E3)"; readonly '--color-accent-muted': "light-dark(#0082FB33, #0082FB3F)"; reado … #a042f923 → const colorVars: stylex.VarGroup<Readonly<{ readonly '--color-accent': "light-dark(#0064E0, #0171E3)"; readonly '--color-accent-muted': "light-dark(#0082FB33, #0082FB3F)"; reado … #9de1262f import {colorVars} from '@astryxdesign/core'
~ core . · Values · const inputWrapperStyles const inputWrapperStyles: Readonly<{ readonly base: Readonly<{ readonly boxSizing: stylex.StyleXClassNameFor<"boxSizing", "border-box">; readonly position: stylex.StyleXClassNameFor<"pos … #90a96087 → const inputWrapperStyles: Readonly<{ readonly base: Readonly<{ readonly boxSizing: stylex.StyleXClassNameFor<"boxSizing", "border-box">; readonly position: stylex.StyleXClassNameFor<"pos … #ba795170 import {inputWrapperStyles} from '@astryxdesign/core'
~ core . · Types · interface TablePlugin transformBodyCell?: (props: BodyCellRenderProps, column: TableColumn<T>, item: T, columnIndex: number, columns: ReadonlyArray<TableColumn<T>>) => BodyCellRenderProps → transformBodyCell?: (props: BodyCellRenderProps, column: TableColumn<T>, item: T, columnIndex: number, columns: ReadonlyArray<TableColumn<T>>, context?: TableRowContext) => BodyCellRenderProps import type {TablePlugin} from '@astryxdesign/core'; const x: TablePlugin = {transformBodyCell: …}
~ core . · Types · interface TablePlugin transformBodyRow?: (props: BodyRowRenderProps, item: T, index: number) => BodyRowRenderProps → transformBodyRow?: (props: BodyRowRenderProps, item: T, index: number, context?: TableRowContext) => BodyRowRenderProps import type {TablePlugin} from '@astryxdesign/core'; const x: TablePlugin = {transformBodyRow: …}
~ core . · Types · interface TablePlugin transformScrollWrapper?: (props: ScrollWrapperRenderProps) => ScrollWrapperRenderProps → transformScrollWrapper?: (props: ScrollWrapperRenderProps, context?: TableRenderContext) => ScrollWrapperRenderProps import type {TablePlugin} from '@astryxdesign/core'; const x: TablePlugin = {transformScrollWrapper: …}
~ core . · Types · interface UseCalendarNavigationReturn visibleCalendarMonths: Array<{ year: number; month: number }> → visibleCalendarMonths: { year: number; month: number }[] import type {UseCalendarNavigationReturn} from '@astryxdesign/core'; const x: UseCalendarNavigationReturn = {visibleCalendarMonths: …}
~ core . · Types · interface UseTableRowIndexConfig data: T[] → data?: T[] import type {UseTableRowIndexConfig} from '@astryxdesign/core'; const x: UseTableRowIndexConfig = {data: …}
~ core Theme targets · target item (Item) target item (Item) props [align, density] → target item (Item) props [align, density] states [disabled, highlighted, selected] defineTheme({components: {'item': {…}}})
~ core Public attributes · attr data-disabled attr data-disabled (theme reflection on 30 targets) → attr data-disabled (theme reflection on 31 targets) [data-disabled] { … }
~ core Public attributes · attr data-highlighted attr data-highlighted (theme reflection on 1 target) → attr data-highlighted (theme reflection on 2 targets) [data-highlighted] { … }
~ core Public attributes · attr data-selected attr data-selected (theme reflection on 14 targets) → attr data-selected (theme reflection on 15 targets) [data-selected] { … }

Touched components checked; add ci:run-visual, ci:run-a11y or ci:run-rtl to run the full suites.


Generated by PR Enrichment workflow | View full report

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: one blocking issue in the new row-context protocol. The spec side is in order, with the verification row owner-approved at this head.

  • A transformBodyCell handler (an onClick or a contextMenuActions callback) that reads context.logicalIndex when it runs gets the row's pre-sort position after a re-sort, because read tracking only sees reads made during the transform and the moved row stays memoized (tableRowContextUsage.ts:62-65, BaseTable.tsx:374-376); state on TableRowContext and transformBodyCell that context values are read during the transform, warn in development when a tracked getter runs outside a transform, and add that case to TableRowContext.test.tsx (or compare rowIndex for every plugin with a cell transform).

Non-blocking: the comment at useTableRowIndex.tsx:93-94 describes the transform order per row rather than per cell, and the CLI TableRowIndexTable block and the RenumbersWithSort story still tell callers to pass data.

[Automated review]

cixzhang and others added 2 commits November 5, 2026 15:47
…docs say to read during the transform

Read tracking sees only reads made while the transform runs. A callback that
reads logicalIndex later can see a stale value on a memoized row, so the
tracked getters warn once in development outside their plugin's transform,
and TableRowContext and the body transforms say to copy values in time. The
story and CLI block stop passing data to useTableRowIndex.

Co-authored-by: Humberto Virtudes <[email protected]>
@cixzhang

cixzhang commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec a485f67

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: one blocking issue. The late-read problem from the last review is fixed: the context docs now say to read values during the transform, a later read warns in development, and a new test covers it.

  • Miss: useTableRowIndex now ignores a caller's data array in body rows (useTableRowIndex.tsx:113), so a grouped table that passes its ungrouped rows numbers them 2, 3, 5, 6, 7 instead of 1 to 5, although the Table spec says legacy row-index configuration continues outside virtual mode; number from data when the caller passes it and keep the context path for useTableRowIndex(), or amend the spec and changeset if a passed data should stop ordering the numbers.

Non-blocking: the CLI numbered-rows block still says "Pass the rendered data array" above a call that passes none (TableRowIndexTable.tsx:35), and the warnIfLate doc comment would read better as "Tracking sees only reads made during the transform."

[Automated review]

…only the no-data form uses the row context

Legacy row-index configuration continues: a caller who passes data (a
grouped table with its ungrouped rows, a subset view) keeps numbering from
that array. useTableRowIndex() numbers from logicalIndex.

Co-authored-by: Humberto Virtudes <[email protected]>
@cixzhang

cixzhang commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 1f0cbd3

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. Every change is covered by the Table spec, the verification-row edit has an engineering owner's approval for this head, and CI passed on this head.

Non-blocking:

  • Miss: in a grouped table, useTableRowIndex() without data numbers the group header rows too, so five product rows show 2, 3, 5, 6, 7; say in the hook's JSDoc and useTableRowIndex.doc.mjs that a grouped table passes its ungrouped rows as data.
  • Miss: the new FR17 verification row ends "or numbering from a data lookup fails", which reads against the kept data path; "or numbering without data from a data lookup fails" says what the tests check.
  • Still open from the last review: identityStatus is always valid (types.ts:453), and the "in time" comment at tableRowContextUsage.ts:22.

The committed packages/core/api-report.md is stale (hand-edited rows land on UseTableSelectionStateConfig and inside TableSemanticRowStatus); pnpm api:report regenerates it.

[Automated review]

export interface TableRowContext {
/** The row's key: its `idKey` value, or its index when there is no `idKey`. */
readonly key: string | number | undefined;
/** Whether the key is a usable identity. */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking (miss): BaseTable always sets identityStatus: 'valid', so duplicate idKey values and index keys both report valid. A plugin that trusts this to keep per-row state would attach it to the wrong row after a re-sort. Until an identity opt-in validates keys, say so:

/** Table reports `valid` until an identity opt-in validates keys. */

>();
let transformingPlugin: object | null = null;

/** Run one plugin transform; context reads inside it are in time. */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking (miss, INV29 style: vague "in time"). Suggested:

/** Run one plugin transform. Row memoization sees only the context reads made inside it. */

@cixzhang
cixzhang marked this pull request as ready for review November 6, 2026 06:38
@cixzhang
cixzhang marked this pull request as draft November 6, 2026 06:57
@cixzhang

cixzhang commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 1f0cbd3

@cixzhang
cixzhang marked this pull request as ready for review November 7, 2026 14:27
@cixzhang
cixzhang merged commit 5e0f3d3 into main Nov 7, 2026
182 checks passed
@github-actions
github-actions Bot deleted the lane4/table-row-context branch November 8, 2026 06:03

This branch was successfully deployed

1 active deployment
Preview — 1f0cbd32 Deployed Nov 6, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Table: expose row position to plugins (aria-rowindex) so useTableRowIndex avoids its own index map

1 participant