Repository navigation
docs: useTableSortableState comparator rules; Table has no row-click prop - #12884
josephfarina wants to merge 11 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
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 aDatesorts 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:105matchesuseTableSortableState.tsx:72-134anduseTableSortable.tsx:265-266, and it is the first paragraph ofastryx 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 ofastryx 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.
There was a problem hiding this comment.
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:105matchesuseTableSortableState.tsx:72-134anduseTableSortable.tsx:265-266, and it is the first paragraph ofastryx component useTableSortableState. - Claim: it says arrays and plain objects have no sort text, so they need a comparator. Verified:
useTableSortableState.doc.mjs:58,:105and:142matchuseTableSortableState.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 ofastryx 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.
b3f3ec3 to
1fcbb20
Compare
There was a problem hiding this comment.
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:58and:142matchuseTableSortableState.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-44and: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-86type-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:321is the first paragraph ofastryx 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,:142and: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,:424and: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
onRowprop inTable/types.tsorTable.tsx, and no activation plugin underTable/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.
…-click prop [skip ci]
… dense best practice, example columns) [skip ci]
…e params [skip ci]
…nce without generic words [skip ci]
[skip ci]
1fcbb20 to
c116d11
Compare
There was a problem hiding this comment.
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:58and:142matchuseTableSortableState.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-44and:185-195, and a run puts it withnullandNaN, 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-86type-checks against this head's sources and orders blocked, active, done. - Release note: Table's
columnsprop says Table has no onRowClick prop and to put a Link or Button in the main cell. Verified:Table.doc.mjs:208, printed on thecolumnsline ofastryx 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-59and:204. - Description: Table has no row-click prop. Verified: no
onRowprop inTable/types.tsorTable.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,:142and: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-89and 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.
|
Landed in #13059. |
- #12884 docs: useTableSortableState comparator rules; Table has no row-click prop Author: @josephfarina
Reader impact
In blind tests, agents still read package files for two things:
astryx component useTableSortableStateanswer 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.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>>, allowUnsortedStatetrue, isMultiSortEnabledfalse).defaultCompareturns 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
config.comparatorsparam (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:TableFR25). 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.useTableSortableStatecomparators, with typed rows and its own sortable columns.columnsprop (which the defaultcomponent Tableanswer 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 useTableSortableStateprints the new first sentence ofconfig.comparators, and--detail fullorastryx hook useTableSortableStateprints the whole param and the best practice.astryx component Table(also--zhand--dense) prints the newcolumnssentence.Scope
Components: Table, useTableSortable, useTableSortableState
Testing
astryx component useTableSortableStateandastryx component Table(en, zh, dense) on this branch.preflight: pass c116d11 (test-node left to the batch: about 2,400 files)