Skip to content

fix(Table): the default cell renderer shows an Invalid Date as an empty cell - #12941

Closed
josephfarina wants to merge 4 commits into
mainfrom
ca2-cell-invalid-date
Closed

josephfarina wants to merge 4 commits into
mainfrom
ca2-cell-invalid-date

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

What changes for users

A Table column without renderCell crashed when a cell held an Invalid Date (for example new Date('not a date') from a bad API value): Table's default cell renderer called toISOString(), which throws a RangeError for it. Now the cell renders empty, as it does for null and undefined. 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, undefined and NaN. 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-spec on #12921), and the same owner's team decided that this display follows the same rule; an /approve-spec on this head covers both.

Fix

isInvalidDate in Table/columnUtils.ts is the one check for a Date with no time. Both the default cell renderer and useTableSortableState's missing-value check use it. It is internal (not exported from the package). NaN keeps its current display; only the Invalid Date case changes.

Tree tables

In a tree table with expandable rows, useTableTreeData wraps the tree column's cell and had its own String(value ?? '') fallback, which printed "Invalid Date" (and a valid Date as Date.toString() text). That fallback now calls defaultCellRenderer, so the tree column shows the same text as a plain column.

Tests

Table.test.tsx adds defaultCellRenderer cases: an Invalid Date renders as an empty string like null, a valid Date still renders its ISO text, and isInvalidDate tells the two apart. useTableTreeData.test.tsx adds 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:Table gains FR25: Table treats null, undefined and an Invalid Date as missing cell values. The default cell renderer shows them as an empty cell and never throws, and useTableSortableState's default comparator sorts them (and NaN) after every other value in ascending order and first in descending order. A renderCell or comparators entry replaces these defaults. A Verification-map row names the Table.test.tsx defaultCellRenderer suite and the useTableSortableState.test.tsx NaN, null and Invalid Date suites, and verified_by adds that sort test file. pnpm check:knowledge passes.

Writing rubric results

  • R1 (narration): none. FR25 states what Table does, in the present tense.
  • R2 (research): none.
  • R3 (PR/issue references in evidence or basis cells): none. Basis is "Owner decision, 2026-11-19"; verification names test suites.
  • R4 (rejected alternatives): none recorded.
  • R5 (#digits, /pull/, /issues/ in the record): none added.
  • R6 (answered open questions that still list options): none.
  • R7 (project status): none. Evidence state "Implemented; unit-tested" is the template's evidence field.

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 defaultCellRenderer and 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:Table FR25).

Changeset

[fix] for @astryxdesign/core (patch).

Stack: #12921 → #12941 (this layer's base branch is ca2-sort-invalid-date).

@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 19, 2026 7:36pm 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 19, 2026, 7:55 PM UTC

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec ed61fd8

@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.

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 NaN numbers, which still display as NaN, 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 renderCell no longer throws on an Invalid Date: verified; the old renderer called toISOString() on any Date, the new one checks first (columnUtils.ts:296).
  • Changeset, the default renderer shows an Invalid Date as an empty cell like null and undefined: 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 RangeError from toISOString(): verified (base columnUtils.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-76 and Table/utils.ts:9-16 do not export it, and no public API changes.
  • Description, NaN keeps its display: verified (number branch columnUtils.ts:302-309 unchanged).
  • 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.

Automated review (maintainer link)

@josephfarina
josephfarina marked this pull request as ready for review November 19, 2026 16:18
@josephfarina
josephfarina changed the base branch from ca2-sort-invalid-date to main November 19, 2026 17:30
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec ca8b9e7

@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.

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 renderCell no longer throws on an Invalid Date: verified; the renderer checks before toISOString() (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 null and undefined: verified (columnUtils.ts:296, Table.test.tsx:111-114).
  • Changeset, sorting already treats an Invalid Date as missing: verified (useTableSortableState.tsx:38-44, already on main).
  • Description, the old renderer threw a RangeError from toISOString(): verified (base columnUtils.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, undefined and NaN: 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-76 and Table/utils.ts:9-16 do not export it, and the built API surface is unchanged.
  • Description, NaN keeps its display: verified (columnUtils.ts:302-309 unchanged).
  • 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.

Automated review (maintainer link)

Comment on lines +281 to +282
* 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.

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.

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.
 */

@josephfarina

Copy link
Copy Markdown
Contributor Author

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 null and undefined, instead of the text "Invalid Date". This is the display half of the rule decided on #12921, where useTableSortableState sorts an invalid Date with the missing values. No other value's display changes.

@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 19, 2026
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 07cc4d0

@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 fix is needed before this can merge.

  • component:Table FR25 says a column without renderCell shows an Invalid Date as an empty cell and a valid date as ISO text, but when useTableTreeData has expandable rows the tree column still renders Invalid Date through its own String(value ?? '') fallback (useTableTreeData.tsx:710-713); route that fallback through defaultCellRenderer and 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 renderCell no longer throws on an Invalid Date: verified; the check runs before toISOString() (columnUtils.ts:296, :300), and the tree column never threw.
  • Changeset, the default renderer shows an Invalid Date as an empty cell, like null and undefined: 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 on main).
  • Description, the old renderer threw a RangeError from toISOString(): verified (base columnUtils.ts).
  • Description, the cell now renders empty, as for null and undefined: 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, NaN keeps its display: verified (columnUtils.ts:302-309 unchanged).
  • Description, the tests add three defaultCellRenderer cases: verified (Table.test.tsx:110-127, passing).
  • Description and record, missing values and NaN sort 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, renderCell and comparators replace the defaults: verified (BaseTable.tsx:276-287, useTableSortableState.tsx:227-230).
  • Description, the record's verification row and the added verified_by path: 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 targets main (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.

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec c3587c8

@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: 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.tsx and its test came after that run, so rerun pnpm preflight on 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 on ca2-sort-invalid-date above #12921, but it targets main and #12921's change is already on main; 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 null and undefined: 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 on main).
  • 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, NaN keeps 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 NaN sort last ascending and first descending, and renderCell and comparators replace 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_by path: 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.

Automated review (maintainer link)

'@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.

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.

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` |

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.

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.

josephfarina added a commit that referenced this pull request Nov 19, 2026
josephfarina added a commit that referenced this pull request Nov 19, 2026
- #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
@josephfarina

Copy link
Copy Markdown
Contributor Author

Landed in #12992.

@github-actions
github-actions Bot deleted the ca2-cell-invalid-date branch November 20, 2026 06:05

This branch was successfully deployed

1 active deployment
Preview — c3587c8c Deployed Nov 19, 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