Repository navigation
fix(Table): the default cell renderer shows an Invalid Date as an empty cell - #12941
josephfarina wants to merge 4 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec ed61fd8 |
There was a problem hiding this comment.
Approval waits on one owner decision: what a Table column without renderCell shows for an Invalid Date. No current Table record says what the default cell renderer shows for any value, and this pull request picks an empty cell. An engineering owner records that decision by commenting /approve-spec followed by the full SHA of this pull request's head commit; the author may do so as an engineering owner.
What needs settling:
- An empty cell (this change, the same as
null) or a translated message such as the one DateInput shows for an invalid date. - Whether the rule also covers
NaNnumbers, which still display asNaN, and the tree column's own fallback, which still shows the text "Invalid Date" in a tree table with expandable rows.
No code change is required otherwise: the crash is gone, valid dates keep their ISO text, and the added tests cover all three cases.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Changeset, a column without
renderCellno longer throws on an Invalid Date: verified; the old renderer calledtoISOString()on any Date, the new one checks first (columnUtils.ts:296). - Changeset, the default renderer shows an Invalid Date as an empty cell like
nullandundefined: verified (columnUtils.ts:296,Table.test.tsx:111-114). - Changeset, sorting already treats an Invalid Date as missing: verified on the base branch (
useTableSortableState.tsx:38-44); it holds once the pull request below lands. - Description, the old renderer threw a
RangeErrorfromtoISOString(): verified (basecolumnUtils.ts:291-292). - Description, valid dates still render as ISO text: verified (
Table.test.tsx:116-120). - Description, an engineering owner approved the sort rule on the pull request below: verified; that approval covers its own head and the sort only.
- Description, the owner's team decided that display follows the same rule: not shown; no record or comment holds it, so it is the decision above.
- Description, one helper serves the renderer and the sort's missing-value check: verified (
columnUtils.ts:284-286,:296;useTableSortableState.tsx:24,:42). - Description, the helper is internal: verified;
Table/index.ts:70-76andTable/utils.ts:9-16do not export it, and no public API changes. - Description,
NaNkeeps its display: verified (number branchcolumnUtils.ts:302-309unchanged). - Description, the tests add the three cases: verified (
Table.test.tsx:110-127). - Description, a patch fix changeset for core: verified.
.changeset/table-cell-invalid-date.md: clear.packages/core/src/Table/Table.test.tsx: clear.packages/core/src/Table/columnUtils.ts: the empty-cell choice at line 296 waits on the decision above; otherwise clear.packages/core/src/Table/plugins/sortable/useTableSortableState.tsx: clear.
ed61fd8 to
ca8b9e7
Compare
|
/approve-spec ca8b9e7 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet.
A Table column without renderCell now shows an Invalid Date as an empty cell instead of throwing, and an engineering owner recorded that choice with /approve-spec on this head. There are no blocking findings. Optional follow-ups: the tree column's own fallback still shows the text "Invalid Date" in a tree table with expandable rows, the new comment on isInvalidDate has a wording suggestion inline, and the description's stack line is stale now that the sort fix has landed.
Claims and files checked
Review mode: full; reason: rebase
- Changeset, a column without
renderCellno longer throws on an Invalid Date: verified; the renderer checks beforetoISOString()(columnUtils.ts:296,:300), and a rendered table that crashes on the base renders on this head. - Changeset, the default renderer shows an Invalid Date as an empty cell, like
nullandundefined: verified (columnUtils.ts:296,Table.test.tsx:111-114). - Changeset, sorting already treats an Invalid Date as missing: verified (
useTableSortableState.tsx:38-44, already onmain). - Description, the old renderer threw a
RangeErrorfromtoISOString(): verified (basecolumnUtils.ts:291-292). - Description, valid dates still render as ISO text: verified (
Table.test.tsx:116-120). - Description, the earlier sort change counts an Invalid Date as missing, with
null,undefinedandNaN: verified (useTableSortableState.tsx:38-44). - Description, the default renderer adds no text to translate and shows no engine text: verified (no rendered literal added); the tree column's own fallback is a separate path and still shows "Invalid Date".
- Description, an engineering owner approved the sort rule on the earlier pull request: verified (its exact-head approval and owner decision comment).
- Description, an approval on this head covers the display rule: verified (an engineering owner's exact-head
/approve-spec). - Description, one helper serves the renderer and the sort: verified (
columnUtils.ts:284-286,:296;useTableSortableState.tsx:24,:42). - Description, the helper is internal: verified;
Table/index.ts:70-76andTable/utils.ts:9-16do not export it, and the built API surface is unchanged. - Description,
NaNkeeps its display: verified (columnUtils.ts:302-309unchanged). - Description, the tests add the three cases: verified (
Table.test.tsx:110-127). - Description, build, lint and the touched unit tests pass: verified for the core build, lint of the three changed files and both touched test files (185 tests).
- Description, a patch fix changeset for core: verified.
- Description, the stack line and its base branch: stale; the earlier pull request has landed and this one targets
main(non-blocking). .changeset/table-cell-invalid-date.md: clear.packages/core/src/Table/Table.test.tsx: clear.packages/core/src/Table/columnUtils.ts: comment wording at lines 281-282 (non-blocking, inline); otherwise clear.packages/core/src/Table/plugins/sortable/useTableSortableState.tsx: clear.
| * Whether a value is a Date with no time (`new Date('not a date')`). Table | ||
| * treats it as a missing value: an empty cell, and sorted with null. |
There was a problem hiding this comment.
Optional, non-blocking (comment wording): "a Date with no time" reads as a date without a time of day, and the tree column's own fallback in useTableTreeData.tsx still shows Invalid Date, so "Table treats it as a missing value" is broader than this helper. A shorter, exact version:
/**
* Whether a value is an Invalid Date (`new Date('not a date')`), whose time
* is NaN. The default cell renderer shows it as an empty cell; the sort puts
* it with null.
*/|
Owner decision (engineering owner, recorded for this batch and #12941): Table's default cell renderer shows an invalid Date (one whose time is NaN) as an empty cell, the same as |
… undefined, Invalid Date) [skip ci]
|
/approve-spec 07cc4d0 |
There was a problem hiding this comment.
Changes requested: one fix is needed before this can merge.
component:TableFR25 says a column withoutrenderCellshows an Invalid Date as an empty cell and a valid date as ISO text, but whenuseTableTreeDatahas expandable rows the tree column still rendersInvalid Datethrough its ownString(value ?? '')fallback (useTableTreeData.tsx:710-713); route that fallback throughdefaultCellRendererand add a tree-table test, or narrow FR25 and the description to the default renderer and approve the record again.
The crash fix itself checks out: flat columns render an empty cell, the sort still groups an Invalid Date with the missing values, and FR25 is approved by an engineering owner for this head. Two optional points: the open wording thread on the isInvalidDate comment, and the description's stale stack line.
Claims and files checked
Review mode: full; reason: spec-record
- Changeset, a column without
renderCellno longer throws on an Invalid Date: verified; the check runs beforetoISOString()(columnUtils.ts:296,:300), and the tree column never threw. - Changeset, the default renderer shows an Invalid Date as an empty cell, like
nullandundefined: verified (columnUtils.ts:296,Table.test.tsx:111-114, and a rendered flat Table). - Changeset, sorting already treats an Invalid Date as missing: verified (
useTableSortableState.tsx:38-44; the same check was inline onmain). - Description, the old renderer threw a
RangeErrorfromtoISOString(): verified (basecolumnUtils.ts). - Description, the cell now renders empty, as for
nullandundefined: verified for every column the default renderer draws; false for the tree column of a tree table with expandable rows (blocking finding). - Description, valid dates still render ISO text: verified (
Table.test.tsx:116-120). - Description, no new text to translate and no engine text shown: verified for the default renderer; the tree column still shows the engine text
Invalid Date(blocking finding). - Description, the sort rule was approved on the earlier pull request and an approval on this head covers both: verified (an engineering owner's approval for this exact head).
- Description, one internal helper serves the renderer and the sort: verified (
columnUtils.ts:284-286,:296;useTableSortableState.tsx:24,:42). - Description, the helper is not exported from the package: verified; the package entry points do not export it and the built API surface is unchanged.
- Description,
NaNkeeps its display: verified (columnUtils.ts:302-309unchanged). - Description, the tests add three
defaultCellRenderercases: verified (Table.test.tsx:110-127, passing). - Description and record, missing values and
NaNsort last ascending and first descending without throwing: verified (useTableSortableState.tsx:185-195,:228-233; its NaN, null and Invalid Date tests pass). - Description and record,
renderCellandcomparatorsreplace the defaults: verified (BaseTable.tsx:276-287,useTableSortableState.tsx:227-230). - Description, the record's verification row and the added
verified_bypath: the paths exist; the row's failure case is not exercised for the tree column (part of the blocking finding). - Description, the knowledge check passes: verified.
- Description, writing rubric results: verified; FR25 is present tense and cites no pull request.
- Description, install, lint, build, typecheck and the touched tests pass: verified (core build and typecheck, lint of the changed files, 234 touched tests); the full node suite has not run on this head.
- Description, the head since preflight adds only record lines: verified.
- Description, a patch fix changeset for core: verified.
- Description, the stack line and its base branch: stale; the earlier pull request is closed, its change is on
main, and this one targetsmain(non-blocking). .changeset/table-cell-invalid-date.md: clear.docs/specs/components/Table/Table.spec.md: FR25 and its verification row claim more than Table does for the tree column (blocking).packages/core/src/Table/Table.test.tsx: clear.packages/core/src/Table/columnUtils.ts: clear; the comment wording thread is still open (non-blocking).packages/core/src/Table/plugins/sortable/useTableSortableState.tsx: clear.
|
/approve-spec c3587c8 |
There was a problem hiding this comment.
Changes requested: the code fix checks out, and two lines of the description need correcting before this can merge.
- The Preflight section says the head since the preflight run adds only the FR25 record lines, but the tree-column fix in
useTableTreeData.tsxand its test came after that run, so rerunpnpm preflighton this head and update the line, or say the tree-column commit came after it (in the same edit, the Tests section's valid dates sit on a top-level row and a nested row, not a parent). - Miss: the
Stack:line says this pull request sits onca2-sort-invalid-dateabove #12921, but it targetsmainand #12921's change is already onmain; earlier reviews called the line stale without blocking on it, so delete or correct it.
The tree column now renders through the default cell renderer, so component:Table FR25 holds for every column without renderCell, and FR25 carries an engineering owner's approval for this head. Optional: the changeset could say that a valid date in a tree column now shows ISO text, and the renderCell JSDoc in types.ts still says the default is String(item[key]).
Claims and files checked
Review mode: incremental; reason: none
- Changeset, a column without
renderCell, the tree column included, no longer throws or prints engine text for an Invalid Date: verified (columnUtils.ts:296,useTableTreeData.tsx:711; the new tree test fails on the base and passes here). - Changeset, the default renderer shows an Invalid Date as an empty cell, like
nullandundefined: verified (columnUtils.ts:296,Table.test.tsx:111-114). - Changeset, sorting already treats an Invalid Date as missing: verified (
useTableSortableState.tsx:38-44; the same check is onmain). - Description, the old renderer called
toISOString(), which throws for an Invalid Date: verified (the base renderer, and the base Table fails to render with "Invalid time value"). - Description, the cell now renders empty and valid dates keep their ISO text: verified for flat and tree columns (
Table.test.tsx:110-127,useTableTreeData.test.tsx:805-853, rendered frames). - Description, the earlier pull request decided that an Invalid Date sorts with the missing values: verified (its change is on
main, with an engineering owner's approval there). - Description, no new text to translate and no engine text shown: verified.
- Description, an approval on this head covers both halves: verified (an engineering owner's approval for this exact head).
- Description, one internal helper serves the renderer and the sort: verified (
columnUtils.ts:284-286,:296;useTableSortableState.tsx:24,:42). - Description, the helper is not exported from the package: verified (the Table entry points do not export it; the built API surface is unchanged).
- Description,
NaNkeeps its display and only the Invalid Date case changes in the default renderer: verified (columnUtils.ts:302-309). - Description, the tree column's own fallback printed "Invalid Date" and the long date text, and now calls the default renderer: verified (
useTableTreeData.tsx:707-713). - Description, the tests add three default-renderer cases: verified (
Table.test.tsx:110-127). - Description, the tree test checks an Invalid Date and valid dates on "a parent and a nested row" and fails on the old fallback: verified, except that the valid dates sit on a top-level row and a nested row (part of the first blocking finding).
- Description and record, missing values and
NaNsort last ascending and first descending, andrenderCellandcomparatorsreplace the defaults: verified (useTableSortableState.tsx:38-44,:227;BaseTable.tsx:276-287;useTableTreeData.tsx:709-710). - Description, the record's verification row and the added
verified_bypath: verified (Table.spec.md:26,:483). - Description, the knowledge check passes: verified on this head.
- Description, writing rubric results: verified; FR25 is present tense and cites no pull request.
- Description, install, lint, build, typecheck and the touched ui tests pass: verified on this head (core build and typecheck, ESLint on the changed files, 233 touched tests).
- Description, the locale re-sort test fails on the author's machine: it passes here; not a finding.
- Description, the head since the preflight run adds only the FR25 record lines: false; the tree-column code, its test and a changeset edit came after it (blocking).
- Description, the stack line and its base branch: false; this pull request targets
main(blocking). - Description, a patch fix changeset for core: verified.
.changeset/table-cell-invalid-date.md: clear; optional note on tree-column dates.docs/specs/components/Table/Table.spec.md: clear; optional note on the verification row.packages/core/src/Table/Table.test.tsx: clear.packages/core/src/Table/columnUtils.ts: clear; the comment wording thread stays open (optional).packages/core/src/Table/plugins/sortable/useTableSortableState.tsx: clear.packages/core/src/Table/plugins/tree/useTableTreeData.test.tsx: clear; fails on the base, passes on this head.packages/core/src/Table/plugins/tree/useTableTreeData.tsx: clear.
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [fix] A Table column without `renderCell`, the tree column of a tree table included, no longer throws or prints engine text when a cell holds an Invalid Date. The default cell renderer now shows an Invalid Date as an empty cell, as it does for null and undefined. Sorting already treats it as a missing value. |
There was a problem hiding this comment.
Optional, non-blocking: in a tree table, a valid date in the tree column also changes, from the long date text (Mon Jan 01 2024 00:00:00 GMT+0000 (…)) to ISO text, because that column now uses the default renderer. One clause tells tree-table users to expect it, for example:
The tree column of a tree table now shows the same text as a plain column, so a valid date there shows ISO text.
| | FR12, PR1 | `Table.perf.test.tsx` and `internByIdentity.test.ts`, plus `useBaseTablePlugins.ts` and `internByIdentity.ts` source inspection | Same plugin references, recreated record, and changed plugin value | Unchanged plugin values must preserve the resolved array and representative no-op row-update budgets; focused named-record identity coverage remains partial. | `audit:Table/performance` | | ||
| | FR13, PR3 | `Table.test.tsx`, `plugins/columnResize/useTableColumnResize.test.tsx`, `plugins/stickyColumns/useTableStickyColumns.test.tsx`, and `Table.stories.tsx` ResponsiveScroll play assertions; for the windowed row-position floor, `plugins/rowIndex/useTableRowIndex.test.tsx` and a real-browser windowing check, including an append from 999 to 1,000 rows while scrolled to the end, re-measurement after a font, theme, density or host-inset change, and a pinned column after a widened row-number column keeping its inline start at the end of the columns before it (an overlap fails) | Width-less columns with empty, short, and long-token rows; mixed explicit widths; pinned columns; narrow and fitting containers; windowed numbering at each density's first 48px overflow: compact row 10,000, balanced row 1,000, spacious row 100 | Removing the 60px floor, deriving it from row content, changing explicit width semantics, desynchronizing resize bounds or sticky offsets, or preventing the existing Scroll region from activating fails focused unit or real-browser geometry assertions. A windowed number column that clips a number, falls back when a longer number mounts or its font or padding changes (host inset included), or narrows below its authored width, or an unwindowed one that widens, fails. | `audit:Table/layout` | | ||
| | FR24 | `TableHeaderCell.test.tsx` (a header cell carries the zero width cap under `truncate` and none under `wrap`) and the `ChildrenModeNarrow` story play assertions in real Chromium | A six-column children-mode table in a 320px box; the same table under `truncate`; a fitting children-mode table | A wrapping children-mode table that squeezes into its box, breaks a word that fits its column, or cuts a heading, or a truncating one that grows past its box, fails | `audit:Table/layout` | | ||
| | FR25 | `Table.test.tsx` `defaultCellRenderer` suite (an Invalid Date and `null` render as an empty cell; a valid Date renders its ISO text; `isInvalidDate` tells them apart) and `plugins/sortable/useTableSortableState.test.tsx` NaN, null and Invalid Date suites | An Invalid Date, `null` and a valid Date in a default-rendered column; the same values sorted ascending and descending | A default cell that throws or shows text for an Invalid Date, or a sort that throws or places an Invalid Date anywhere but with the missing values, fails | `audit:Table/plugins` | |
There was a problem hiding this comment.
Optional, non-blocking: this row names the Table.test.tsx and sort suites, but FR25's tree-column case is proven by the new useTableTreeData.test.tsx suite ("default tree cell text"), which only the tree module's record lists. Naming it here keeps the tree-column claim traceable from FR25; a record edit needs a new /approve-spec.
- #12941 fix(Table): the default cell renderer shows an Invalid Date as an empty cell Author: @josephfarina - #12886 docs(core): the README setup loads the theme's fonts Author: @josephfarina - #12887 fix(cli): doctor --built reads the setup stylesheet as wiring, not page styling Author: @josephfarina - #12456 fix(cli): a doc may leave out a value the code deprecates everywhere Author: @josephfarina - #12857 docs(cli): the styling and typography pages state their core rules Author: @josephfarina - #12994 test(cli): the doctor golden leaves out a check only some computers report Author: @josephfarina - #13001 test(cli): the swizzle proof renders Lab's MediaPlayer with its required label Author: @josephfarina
|
Landed in #12992. |
What changes for users
A Table column without
renderCellcrashed when a cell held an Invalid Date (for examplenew Date('not a date')from a bad API value): Table's default cell renderer calledtoISOString(), which throws aRangeErrorfor it. Now the cell renders empty, as it does fornullandundefined. Valid dates still render as their ISO text.Why this behavior
The pull request below this one decided that an Invalid Date is a missing value: it sorts with
null,undefinedandNaN. This layer applies the same rule to display, so a broken date shows as an empty cell. That adds no new text to translate and shows no engine text such as "Invalid Date" in the user's data. An engineering owner approved counting an Invalid Date as a missing value for sorting on the pull request below (/approve-specon #12921), and the same owner's team decided that this display follows the same rule; an/approve-specon this head covers both.Fix
isInvalidDateinTable/columnUtils.tsis the one check for a Date with no time. Both the default cell renderer anduseTableSortableState's missing-value check use it. It is internal (not exported from the package).NaNkeeps its current display; only the Invalid Date case changes.Tree tables
In a tree table with expandable rows,
useTableTreeDatawraps the tree column's cell and had its ownString(value ?? '')fallback, which printed "Invalid Date" (and a valid Date asDate.toString()text). That fallback now callsdefaultCellRenderer, so the tree column shows the same text as a plain column.Tests
Table.test.tsxaddsdefaultCellRenderercases: an Invalid Date renders as an empty string likenull, a valid Date still renders its ISO text, andisInvalidDatetells the two apart.useTableTreeData.test.tsxadds a tree table with a Date tree column: an Invalid Date shows no text, and valid dates (a parent and a nested row) show their ISO text; the test fails on the old fallback.Record
component:Tablegains FR25: Table treatsnull,undefinedand an Invalid Date as missing cell values. The default cell renderer shows them as an empty cell and never throws, anduseTableSortableState's default comparator sorts them (andNaN) after every other value in ascending order and first in descending order. ArenderCellorcomparatorsentry replaces these defaults. A Verification-map row names theTable.test.tsxdefaultCellRenderersuite and theuseTableSortableState.test.tsxNaN, null and Invalid Date suites, andverified_byadds that sort test file.pnpm check:knowledgepasses.Writing rubric results
#digits,/pull/,/issues/in the record): none added.Preflight
Install, lint, build, typecheck and the test-ui gates passed; the node tests the change reaches (2,433 files) are left to the batched CI run. The touched ui tests were run on their own: the new
defaultCellRendererand Invalid Date sort cases pass; "re-sorts strings when the provider locale changes" fails there and also fails at the merge base with that machine's Node.preflight: pass ed61fd8 (test-node left to the batch: 2,433 files); the head since adds the FR25 record lines only (rebase onto main after the lower pull request merged, then
component:TableFR25).Changeset
[fix]for@astryxdesign/core(patch).Stack: #12921 → #12941 (this layer's base branch is
ca2-sort-invalid-date).