Skip to content

docs: useTableSortableState comparator rules; Table has no row-click prop - #12884

Closed
josephfarina wants to merge 11 commits into
mainfrom
ca2-answers-5
Closed

josephfarina wants to merge 11 commits into
mainfrom
ca2-answers-5

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Reader impact

In blind tests, agents still read package files for two things:

  1. useTableSortableState comparators. The default astryx component useTableSortableState answer prints only the first sentence of each param. The facts agents needed (arrays have no sort text; how a Date and an Invalid Date order) were not in it or anywhere in the docs, and the null, undefined and NaN order was only in the whole param, which the default answer cuts. So agents read the type files.
  2. Row click on Table. The default Table answer never said that Table has no row-click prop (only the full answer's best practices did), so agents searched Core for onRowClick.

Source of truth

  • packages/core/src/Table/plugins/sortable/useTableSortableState.tsx: UseTableSortableStateConfig (data, defaultSort [], sort/onSortChange, comparators?: Partial<Record<TSortKey, (a: T, b: T) => number>>, allowUnsortedState true, isMultiSortEnabled false). defaultCompare turns values that are not a string, number, boolean, bigint or Date into empty text, so arrays and objects compare as equal.
  • packages/core/src/Table/types.ts / Table.tsx: Table has no row-click prop. Row activation has a current contract (module:Table/useTableActivation) whose plugin is not built yet; contributor PR feat(table): add useTableActivation row-activation plugin #8861 builds it, and this PR does not touch that API. When it lands, this sentence should also point master-detail callers to the plugin. It only states today's pattern, which the Table best practices already show.

Correction

  • useTableSortableState: the first sentence of the config.comparators param (what the default answer prints) now says arrays such as tags need a comparator because they have no sort text. The rest of the param says arrays and plain objects compare as equal to each other and sort before text in ascending order, a Date sorts by its time, and an Invalid Date sorts with null, undefined and NaN (component:Table FR25). The comparator best practice and the dense copies match. The usage paragraph is unchanged, so hook search (which indexes the name, keywords and usage paragraph) is unaffected.
  • useTableSortable: a new third example sorts by a status rank and a tags array through useTableSortableState comparators, with typed rows and its own sortable columns.
  • Table: the first sentence of the columns prop (which the default component Table answer prints) now says Table has no onRowClick prop: to open a row, put a Link or Button in its main cell's renderCell. Component search does not index prop text, and Table's description and usage paragraph are unchanged from main, so Table's search ranking does not move. The best practice already shows the Link/Button pattern.

Evidence

On this branch, astryx component useTableSortableState prints the new first sentence of config.comparators, and --detail full or astryx hook useTableSortableState prints the whole param and the best practice. astryx component Table (also --zh and --dense) prints the new columns sentence.

Scope

Components: Table, useTableSortable, useTableSortableState

  • This PR changes documentation only, or names every necessary generated artifact.
  • Runtime, API, visual, and policy changes were removed or split.
  • Public text and artifacts contain no internal Meta context.

Testing

  • astracat preflight: install, lint, build, typecheck and the test-ui gates passed on an earlier head; the node tests the change reaches (about 2,400 files) are left to the batched CI run. The review half passed at this head.
  • Search: Table's indexed fields (description, usage paragraph, keywords, best practices) and the hook's usage paragraph are unchanged from main, so search ranking does not move.
  • Rendered astryx component useTableSortableState and astryx component Table (en, zh, dense) on this branch.

preflight: pass c116d11 (test-node left to the batch: about 2,400 files)

@vercel

vercel Bot commented Nov 19, 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 20, 2026 3:20am UTC

Request Review

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

astracat-bot Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 20, 2026, 3:22 AM UTC

@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 pending CI: CI has not run on this head yet, because a draft pull request runs no CI.

Next, mark the pull request ready for review. Its only commit has [skip ci] in its message, and GitHub does not start the CI and Lint pull-request workflows while the head commit says so, so push a commit without it for the required checks to run.

  • Non-blocking: in useTableSortableState.doc.mjs, "Arrays and objects have no sort text and compare as equal" holds for arrays and plain objects, but a Date sorts by its time and an array beside text sorts first in ascending order; consider "Arrays and plain objects have no sort text: they compare as equal to each other and sort before text in ascending order. A Date sorts by its time."
Claims and files checked

Review mode: full; reason: no-earlier-review

  • Claim: the useTableSortableState answer lists its six options with their defaults. Verified: useTableSortableState.doc.mjs:105 matches useTableSortableState.tsx:72-134 and useTableSortable.tsx:265-266, and it is the first paragraph of astryx component useTableSortableState.
  • Claim: it says arrays and objects compare as equal without a comparator. Verified for arrays and plain objects (useTableSortableState.doc.mjs:58, useTableSortableState.tsx:37-50, a runtime check of the hook); the Date edge is the note above.
  • Claim: a new useTableSortable example sorts by a status rank and a tags array. Verified: useTableSortable.doc.mjs:57-81, and it type-checks against this head's sources.
  • Claim: the Table answer's first paragraph says Table has no row-click prop and that a row opens from a Link or Button in its main cell. Verified: Table.doc.mjs:306, the first paragraph of astryx component Table.
  • Claim: no API or behavior changes. Verified: only doc strings change, and the built API surface of core and the seven themes is identical.
  • Description: a draft placeholder with no code claims.
  • File .changeset/sortable-state-options-table-no-row-click.md: clear.
  • File packages/core/src/Table/Table.doc.mjs: clear.
  • File packages/core/src/Table/plugins/sortable/useTableSortableState.doc.mjs: non-blocking wording note at line 58 and its dense copy at line 142.
  • File packages/core/src/Table/useTableSortable.doc.mjs: clear.

Automated review (maintainer link)

@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 pending CI: CI has not run on this head yet, because a draft pull request runs no CI.

Next, mark the pull request ready for review and push a commit whose message does not contain [skip ci]: every commit on this branch carries it, and GitHub does not start the CI and Lint pull-request workflows while the head commit does. The earlier wording note on how a Date sorts is fixed.

Claims and files checked

Review mode: incremental; reason: none

  • changed rules (0): none.
  • Claim: the useTableSortableState answer lists its options, with sort and onSortChange as one controlled pair, and their defaults. Verified: useTableSortableState.doc.mjs:105 matches useTableSortableState.tsx:72-134 and useTableSortable.tsx:265-266, and it is the first paragraph of astryx component useTableSortableState.
  • Claim: it says arrays and plain objects have no sort text, so they need a comparator. Verified: useTableSortableState.doc.mjs:58, :105 and :142 match useTableSortableState.tsx:37-50, and a run of the hook keeps arrays and plain objects in data order.
  • Claim: a new useTableSortable example sorts by a status rank and a tags array. Verified: useTableSortable.doc.mjs:57-86, and it type-checks against this head's sources.
  • Claim: the Table answer's first paragraph says Table has no row-click prop and that a row opens from a Link or Button in its main cell. Verified: Table.doc.mjs:306, the first paragraph of astryx component Table.
  • Claim: no API or behavior changes. Verified: only doc strings change, and the built API surface of core and the seven themes is identical.
  • Description: a draft placeholder with no code claims.
  • File .changeset/sortable-state-options-table-no-row-click.md: clear.
  • File packages/core/src/Table/Table.doc.mjs: clear.
  • File packages/core/src/Table/plugins/sortable/useTableSortableState.doc.mjs: clear; the earlier Date wording note is fixed at lines 58 and 142.
  • File packages/core/src/Table/useTableSortable.doc.mjs: clear.

Automated review (maintainer link)

@josephfarina
josephfarina marked this pull request as ready for review November 19, 2026 14:14
@josephfarina josephfarina changed the title docs: useTableSortableState options and comparators; Table has no row-click prop docs: useTableSortableState comparator rules; Table has no row-click prop Nov 19, 2026

@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 pending CI: CI and Lint have not run on this head yet, because its commits carry [skip ci]; the required checks still have to pass before merge.

The comparator wording, the new example and the Table sentence match what the code does today. Two optional cleanups: the dense usage line at useTableSortableState.doc.mjs:156 changes only a colon to a period, although the description says the usage paragraph is unchanged, and Prettier would rewrite the two Table strings with an escaped apostrophe (Table.doc.mjs:321 and :472) with double quotes.

Claims and files checked

Review mode: full; reason: rebase

  • Release note: the useTableSortableState docs say arrays and plain objects have no sort text and need a comparator. Verified: useTableSortableState.doc.mjs:58 and :142 match useTableSortableState.tsx:46-59, and a run of the hook keeps such rows in data order.
  • Release note: a Date sorts by its time. Verified: useTableSortableState.tsx:47-48, and a run sorts dates by time down to the millisecond.
  • Release note: an Invalid Date sorts with the missing values. Verified: useTableSortableState.tsx:38-44 and :185-195, and a run puts it beside null, last ascending and first descending.
  • Release note: a new useTableSortable example sorts by a status rank and a tags array. Verified: useTableSortable.doc.mjs:57-86 type-checks against this head's sources and orders blocked, active, done.
  • Release note: Table's first paragraph says there is no onRowClick prop and to act from the main cell's renderCell. Verified: Table.doc.mjs:321 is the first paragraph of astryx component Table.
  • Release note: no API or behavior changes. Verified: only doc strings change, and the built API surface shows no row from this pull request.
  • Description: the default answer prints only each param's first sentence, which now carries the arrays rule. Verified in the CLI output on both trees.
  • Description: the rest of the param covers arrays, plain objects, Dates and Invalid Dates. Verified as above.
  • Description: the comparator best practice and the dense copies match. Verified: useTableSortableState.doc.mjs:115, :142 and :165.
  • Description: the usage paragraph is unchanged, so hook search is unaffected. Verified for the full paragraph that hook search reads (packages/cli/api/search/_gather-hooks.mjs:38); the dense usage line changes punctuation only.
  • Description: the new example has typed rows and its own sortable columns. Verified: useTableSortable.doc.mjs:58-69.
  • Description: Table's sentence is in the English, Chinese and dense usage paragraphs, and its top-level description is unchanged. Verified: Table.doc.mjs:321, :424 and :472.
  • Description: the Table best practices already show the Link or Button pattern. Verified: Table.doc.mjs:351.
  • Description: the default comparator gives values other than strings, numbers, booleans, bigints and Dates empty sort text. Verified: useTableSortableState.tsx:46-59.
  • Description: the config fields and defaults in the source-of-truth list. Verified: useTableSortableState.tsx:81-143.
  • Description: Table has no row-click prop, and row activation is a specified plugin that is not built yet. Verified: no onRow prop in Table/types.ts or Table.tsx, and no activation plugin under Table/plugins.
  • Description: the CLI answers print the new text. Verified by running them on both trees.
  • Description: the search goldens pass. Verified on this head, apart from one test that needs a git checkout and fails the same way on the base tree.
  • Description: the preflight run on an earlier commit. Not checkable here; it is the author's local run.
  • File .changeset/sortable-state-options-table-no-row-click.md: clear.
  • File packages/core/src/Table/Table.doc.mjs: clear, apart from the optional Prettier cleanup.
  • File packages/core/src/Table/plugins/sortable/useTableSortableState.doc.mjs: clear, apart from the optional dense usage cleanup; the earlier Date wording note is fixed.
  • File packages/core/src/Table/useTableSortable.doc.mjs: clear.

Automated review (maintainer link)

Comment thread packages/core/src/Table/Table.doc.mjs Resolved

@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 pending CI: the required CI and Lint checks have not run on this head yet (its commits carry [skip ci]), and they still have to pass before merge.

The comparator wording, the new sorting example and the columns sentence match what the hook and Table do today, and the two optional cleanups from the last review are fixed, so nothing needs to change.

Claims and files checked

Review mode: full; reason: rebase

  • Release note: the useTableSortableState docs say arrays and plain objects have no sort text and need a comparator. Verified: useTableSortableState.doc.mjs:58 and :142 match useTableSortableState.tsx:46-59, and a run of the hook keeps such rows equal, in data order, before text ascending.
  • Release note: a Date sorts by its time. Verified: useTableSortableState.tsx:47-48, and a run sorts Dates by time down to the millisecond.
  • Release note: an Invalid Date sorts with the missing values. Verified: useTableSortableState.tsx:38-44 and :185-195, and a run puts it with null and NaN, last ascending and first descending.
  • Release note: a new useTableSortable example sorts by a status rank and a tags array. Verified: useTableSortable.doc.mjs:57-86 type-checks against this head's sources and orders blocked, active, done.
  • Release note: Table's columns prop says Table has no onRowClick prop and to put a Link or Button in the main cell. Verified: Table.doc.mjs:208, printed on the columns line of astryx component Table.
  • Release note: no API or behavior changes. Verified: only doc strings change, and the built API surface shows no row.
  • Description: the default answer prints only each param's first sentence, so the arrays rule and the missing-value order were cut before. Verified in the CLI output on both trees.
  • Description: before this change the docs said nothing about arrays, Dates or an Invalid Date. Verified on the base docs.
  • Description: the default Table answer never said Table has no row-click prop; only the full answer's best practice did. Verified in the CLI output on the base.
  • Description: the config fields and defaults in the source-of-truth list. Verified: useTableSortableState.tsx:81-143.
  • Description: the default comparator gives values other than strings, numbers, booleans, bigints and Dates empty sort text. Verified: useTableSortableState.tsx:46-59 and :204.
  • Description: Table has no row-click prop. Verified: no onRow prop in Table/types.ts or Table.tsx.
  • Description: row activation has a specified plugin that is not built yet, which an open contributor pull request builds, and this change does not touch it. Verified: no activation plugin under Table/plugins, and that pull request is still open.
  • Description: the comparators first sentence now names the arrays rule. Verified: useTableSortableState.doc.mjs:58.
  • Description: the rest of the param covers arrays, plain objects, Dates and an Invalid Date. Verified as above.
  • Description: the comparator best practice and the dense copies match. Verified: useTableSortableState.doc.mjs:115, :142 and :165.
  • Description: the usage paragraph is unchanged, so hook search is unaffected. Verified: no usage change, and hook search reads only the name, keywords and usage paragraph (packages/cli/api/search/_gather-hooks.mjs:37-38).
  • Description: the new example has typed rows and its own sortable columns. Verified: useTableSortable.doc.mjs:59-69.
  • Description: component search does not index prop text, and Table's description, usage paragraph, keywords and best practices are unchanged. Verified: packages/cli/api/search/_gather-components.mjs:88-89 and the diff.
  • Description: the Table best practice already shows the Link or Button pattern. Verified: Table.doc.mjs:351.
  • Description: the CLI answers, plain, Chinese and dense, print the new text. Verified by running them on both trees.
  • Description: the change is docs only, with no runtime, API, visual or policy change and no internal context. Verified: the diff, the built API surface and a scan of every added line.
  • Description: the local preflight runs on an earlier head and at this head. Not checkable here; they are the author's local runs.
  • File .changeset/sortable-state-options-table-no-row-click.md: clear.
  • File packages/core/src/Table/Table.doc.mjs: clear; the earlier Prettier note is fixed.
  • File packages/core/src/Table/plugins/sortable/useTableSortableState.doc.mjs: clear; the earlier dense usage note is fixed.
  • File packages/core/src/Table/useTableSortable.doc.mjs: clear.

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

Landed in #13059.

josephfarina added a commit that referenced this pull request Nov 20, 2026
- #12884 docs: useTableSortableState comparator rules; Table has no row-click prop
  Author: @josephfarina
@github-actions
github-actions Bot deleted the ca2-answers-5 branch November 21, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — c116d11f Deployed Nov 20, 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.

1 participant