Repository navigation
docs: Toast needs no provider; Table hooks name their row-type generic - #12696
josephfarina wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec e3fe3ab |
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| TableBody | 3.5 kB (0) · 3.3 kB CSS (0) | — | — · ✓ · ✗ |
| TableFooter | 3.5 kB (0) · 3.3 kB CSS (0) | — | — · ✓ · ✗ |
| TableHeader | 3.5 kB (0) · 3.3 kB CSS (0) | — | — · ✓ · ✗ |
6 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| TableRow | 7.1 kB (0) · 4.0 kB CSS (0) | — | — · ✓ · ✗ |
| Table | 121.7 kB (0) · 19.8 kB CSS (0) | — | — · ✓ · — |
| TableCell | 104.6 kB (0) · 19.3 kB CSS (0) | — | — · ✓ · ✓ |
| TableHeaderCell | 104.4 kB (0) · 19.1 kB CSS (0) | — | — · ✓ · ✓ |
| TableSelectionToolbar | 76.7 kB (0) · 14.1 kB CSS (0) | — | — · ✓ · ✓ |
| Toast · Storybook | 105.6 kB (0) · 11.1 kB CSS (0) | 1,739 (0) | — · ✓ · ✓ |
Package size: @astryxdesign/core 7.68 MB packed (+1.9 kB); no new dependencies.
Touched components checked; for the full suites, add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.
Current run: CI concluded cancelled; parts of this report may be missing.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Changes requested. The Toast and row-type corrections match the code, and every new example compiles under strict TypeScript, but one change hides the hook's usage code from the default CLI answer.
- The first
useTableSortableexample is now 28 lines (useTableSortable.doc.mjs:18-45), over the CLI's 20-line limit for the short answer, soastryx component useTableSortableand--denseno longer print any usage code; keep the first example at 20 lines or fewer, for example by leading with the shorteruseTableSortableStateexample.
The same limit keeps the new useTablePagination example out of that hook's short answer. A small wording fix is suggested inline on useTableColumnSettingsState.doc.mjs.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claim (changeset): the Toast page's first sentence says
useToast()needs no provider or mounted viewport. Verified:Toast.doc.mjs:137, and it is the lead paragraphastryx component Toastprints. - Claim (changeset): the seven hooks say
Tis the row type, is not inferred, falls back toRecord<string, unknown>, and must be passed. Verified: each hook's signature declaresTwith no default and a config that never names it (for exampleuseTableSortable.tsx:376-379,useTablePagination.tsx:203-205). - Claim (changeset): their examples are typed. Verified: both sortable examples, the new pagination example and the filtering example; the other four hooks have no examples.
- Claim (changeset): no API or behavior changes. Verified: the built API surfaces of Core and the seven themes are identical at base and head.
- Claim (description):
useToastuses the provider's or aToastViewport's context, else mounts a fallback viewport ondocument.bodyand warns once in development. Verified:useToast.tsx:140-144,:69-107,toastHost.tsx:228-241,devWarning.ts:125-136. - Claim (description): hooks whose config names
Tinfer it. Verified: those configs takeUseXConfig<T>; checked withtscfor row status. - Claim (description): without
<Walk>a typed Table rejects the plugin with TS2322, and with it the code compiles. Verified withtscfor sortable, pagination, column resize, sticky columns and infinite scroll. - Claim (description): a key union, or keys the State hooks infer, needs the second type argument. Verified with
tsc(TS2345 for sortable and column settings). - Claim (description): every example compiles against Core. Verified with
tscat this head. - Claim (description): the pagination plugin draws the controls and the caller passes the current page's rows. Verified:
useTablePagination.tsxonly wraps the table withPaginationand never slices data. - Claim (description): the CLI shows the new text for Toast, useTablePagination and useTableSortable. Verified, but the useTableSortable short answer also loses its usage block (the finding above).
- Claim (description): the doc and prop-doc test suites pass apart from one machine-specific failure, and the pre-review report has 0 findings. Verified: 83 node tests and 22 ui tests pass here, and the pre-review report has 0 findings.
- File
.changeset/toast-no-provider-table-hook-row-type.md: clear. - File
packages/core/src/Toast/Toast.doc.mjs: clear. - File
packages/core/src/Table/useTableSortable.doc.mjs: finding (short-answer usage code lost). - File
packages/core/src/Table/useTablePagination.doc.mjs: clear; its new example is also over the short-answer limit. - File
packages/core/src/Table/useTableFiltering.doc.mjs: clear. - File
packages/core/src/Table/useTableColumnResize.doc.mjs: clear. - File
packages/core/src/Table/useTableColumnSettings.doc.mjs: clear. - File
packages/core/src/Table/useTableInfiniteScroll.doc.mjs: clear. - File
packages/core/src/Table/useTableStickyColumns.doc.mjs: clear. - File
packages/core/src/Table/plugins/sortable/useTableSortableState.doc.mjs: clear. - File
packages/core/src/Table/plugins/columnSettings/useTableColumnSettingsState.doc.mjs: non-blocking wording suggestion.
|
/approve-spec 734a5fd |
There was a problem hiding this comment.
Approved pending CI: CI has not finished on this head yet. The Toast and row-type corrections match the code, every changed example compiles under strict TypeScript, and the first useTableSortable and useTablePagination examples now fit the CLI's short answer, so astryx component prints their typed usage.
- Miss: (non-blocking) the
--densereturn notes forsortConfig(useTableSortableState.doc.mjs:151) andcolumnSettingsConfig(useTableColumnSettingsState.doc.mjs:145) still say only to pass the config on; consider naming the type arguments there too, as the English notes now do.
Claims and files checked
Review mode: incremental; reason: none
- changed rules (0): none
- Claim (changeset): the Toast page's first sentence says
useToast()needs no provider or mounted viewport. Verified:Toast.doc.mjs:137, the lead paragraphastryx component Toastprints. - Claim (changeset): the seven hooks say
Tis the row type, is not inferred, falls back toRecord<string, unknown>, and must be passed. Verified: each signature declaresTwith no default and a config that never names it (for exampleuseTableSortable.tsx:376-379,useTablePagination.tsx:203-205). - Claim (changeset): their examples are typed. Verified: both sortable examples, the pagination example and the filtering example; the other three hooks have no examples.
- Claim (changeset): no API or behavior changes. Verified: the built API surfaces of Core and the seven themes are identical at base and head.
- Claim (description):
useToastuses the provider's or aToastViewport's context, else mounts a fallback viewport ondocument.bodyand warns once in development. Verified:useToast.tsx:144,:69-107,ToastViewport.tsx:1031,utils/devWarning.ts:131. - Claim (description): hooks whose config names
Tinfer it and are unchanged. Verified: selection, row expansion, row status, row index and tree data take a config typed withT, and none of their docs change. - Claim (description): without the row type a typed Table rejects the plugin with TS2322, and with it the code compiles. Verified with
tscfor all seven hooks. - Claim (description): a key union, or keys the State hooks infer, needs the second type argument. Verified with
tsc(TS2345 for sortable and column settings). - Claim (description): every example compiles against Core. Verified with
tscat this head for the four changed examples. - Claim (description): the pagination plugin draws the controls and the caller passes the current page's rows. Verified:
useTablePagination.tsxnever slices data. - Claim (description): the State hooks' return notes say to pass the same type arguments on. Verified for the English notes; the dense notes are unchanged (non-blocking note above).
- Claim (description): the CLI shows the new text for Toast, useTablePagination and useTableSortable. Verified in the default and
--densereads. - Claim (description): the doc and prop-doc tests pass apart from one machine-specific failure, and the pre-review report has 0 findings. Verified: 83 node tests and 22 ui tests pass here, and the pre-review report has 0 findings.
- File
.changeset/toast-no-provider-table-hook-row-type.md: clear. - File
packages/core/src/Toast/Toast.doc.mjs: clear. - File
packages/core/src/Table/useTableSortable.doc.mjs: clear; the earlier short-answer finding is fixed. - File
packages/core/src/Table/useTablePagination.doc.mjs: clear. - File
packages/core/src/Table/useTableFiltering.doc.mjs: clear. - File
packages/core/src/Table/useTableColumnResize.doc.mjs: clear. - File
packages/core/src/Table/useTableColumnSettings.doc.mjs: clear. - File
packages/core/src/Table/useTableInfiniteScroll.doc.mjs: clear. - File
packages/core/src/Table/useTableStickyColumns.doc.mjs: clear. - File
packages/core/src/Table/plugins/sortable/useTableSortableState.doc.mjs: clear; its dense return note is unchanged (non-blocking). - File
packages/core/src/Table/plugins/columnSettings/useTableColumnSettingsState.doc.mjs: clear; the earlier wording note is fixed, and its dense return note is unchanged (non-blocking).
- #12367 [experimental] export: checks the file it wrote and names the one file to share Author: @josephfarina - #12405 [experimental] export: the size output names each part of the file under its JSON key Author: @josephfarina - #12295 fix(Markdown): keep task lists inside their column Author: @josephfarina - #12696 docs: Toast needs no provider; Table hooks name their row-type generic Author: @josephfarina - #12733 [experimental] export: a package linked from a folder inside the project is a package, so --reverse gives the page back Author: @josephfarina
|
Landed in #12859. |
Reader impact
In blind tests, agents still read package files for two things:
useToast()needs a provider or a mountedToastViewport. The Toast page's first sentence now says it does not.T, but their config never mentions it. TypeScript cannot inferT, so it becomesRecord<string, unknown>, and<Table<Walk>>rejects the plugin (TablePlugin<Record<string, unknown>>is not assignable toTablePlugin<Walk>). The docs now say so and show typed examples.Source of truth
packages/core/src/Toast/useToast.tsx:useToastreadsToastContext(set by LayerProvider's toast host and byToastViewport), elsegetFallbackContext()mounts aToastViewportondocument.bodyand warns once in development.useTableSortable<T, TSortKey>(config: UseTableSortableConfig<TSortKey>),useTablePagination<T>(config: UseTablePaginationConfig),useTableFiltering<T>,useTableColumnSettings<T, TColumnKey>,useTableColumnResize<T>,useTableInfiniteScroll<T>,useTableStickyColumns<T>: none of these configs mentionT. Hooks whose config usesT(selection, row expansion, row status, row index, tree data) infer it and are unchanged.tscagainst the Core sources: without<Walk>,plugins={{sort: plugin}}on aTableColumn<Walk>[]table fails with TS2322; with<Walk>it passes. A sort-key or column-key union (or keys inferred fromdefaultSort/columnsin the State hooks) also needs the second type argument:useTableSortable<Walk, WalkSortKey>.Correction
const showToast = useToast(), which needs no provider or mounted ToastViewport, and how the fallback viewport works.Tis the row type, that it cannot be inferred and falls back toRecord<string, unknown>, and to pass it (useX<Walk>(…)). The sortable and column-settings pages also cover the key type argument.useState<TableSortState>), a new useTablePagination example (it draws the page controls and you pass the current page's rows), and useTableFiltering. ThesortConfig/columnSettingsConfigreturns of the State hooks say to pass the same type arguments on.tscagainst Core before this PR.Evidence
astryx component Toast,astryx component useTablePaginationandastryx component useTableSortableon this branch show the new text.Scope
Components: Toast, useTableSortable, useTableSortableState, useTablePagination, useTableFiltering, useTableColumnSettings, useTableColumnSettingsState, useTableColumnResize, useTableInfiniteScroll, useTableStickyColumns
Testing
pnpm exec vitest run --project node packages/cli/test/{experimental-isolation,core-doc-quality,core-doc-types,core-prop-docs,golden-reads,docs-graph,docs-topic-refs}.test.mjs: 82 passed, 1 failed. The failure ("doctor reports an invalid installed set", a snapshot mismatch) also fails on this machine on clean main, and no golden changed.pnpm exec vitest run --project ui packages/core/src/docPropLiterals.test.ts packages/core/src/docPropReferences.test.ts: 22 passed.pnpm review:pre: 0 findings.