Skip to content

Fix data table crash by validating column IDs and coercing row IDs#1821

Merged
paustint merged 1 commit into
mainfrom
fix/data-table-crash-regression
Jun 22, 2026
Merged

Fix data table crash by validating column IDs and coercing row IDs#1821
paustint merged 1 commit into
mainfrom
fix/data-table-crash-regression

Conversation

@paustint

Copy link
Copy Markdown
Contributor

Ensure valid column IDs to prevent crashes when malformed data is encountered. Coerce row IDs to strings to maintain consistency during operations.

Copilot AI review requested due to automatic review settings June 22, 2026 18:53

Copilot AI 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.

Pull request overview

This PR hardens the UI data table against malformed inputs by preventing TanStack column-definition construction from throwing on falsy column IDs and by ensuring row IDs are always strings for downstream string operations (e.g., keyboard navigation sentinel checks).

Changes:

  • Coerces TanStack getRowId results to string to prevent runtime crashes when getRowKey returns non-strings.
  • Generates a fallback, positional column id when column.key is missing/empty to avoid TanStack throwing on falsy IDs.
  • Adds/updates unit tests to cover both behaviors.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
libs/ui/src/lib/data-table/grid/grid-constants.ts Adds a defensive runtime check around summary-row ID detection.
libs/ui/src/lib/data-table/grid/grid-column-utils.tsx Prevents crashes when col.key is missing by using optional chaining in metadata label lookup.
libs/ui/src/lib/data-table/grid/core/useJetstreamTable.ts Forces getRowId to return a string to keep row-id operations consistent.
libs/ui/src/lib/data-table/grid/buildColumnDefs.ts Normalizes/backs up TanStack column IDs to avoid crashes on falsy ids.
libs/ui/src/lib/data-table/grid/tests/useJetstreamTable.spec.tsx Adds a test verifying row IDs are coerced to strings.
libs/ui/src/lib/data-table/grid/tests/buildColumnDefs.spec.ts Adds a test verifying fallback column IDs when keys are missing/empty.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread libs/ui/src/lib/data-table/grid/grid-constants.ts
Comment thread libs/ui/src/lib/data-table/grid/core/useJetstreamTable.ts Outdated
Comment thread libs/ui/src/lib/data-table/grid/__tests__/useJetstreamTable.spec.tsx Outdated
Comment thread libs/ui/src/lib/data-table/grid/grid-column-utils.tsx
Comment thread libs/ui/src/lib/data-table/grid/buildColumnDefs.ts
@paustint paustint force-pushed the fix/data-table-crash-regression branch from 5dac949 to 67c3d7d Compare June 22, 2026 22:31
@paustint paustint requested a review from Copilot June 22, 2026 22:44

Copilot AI 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.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread libs/ui/src/lib/data-table/grid/buildColumnDefs.ts
@paustint paustint force-pushed the fix/data-table-crash-regression branch from 67c3d7d to 9660829 Compare June 22, 2026 22:51
@paustint paustint requested a review from Copilot June 22, 2026 22:51

Copilot AI 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.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

@paustint paustint merged commit afb0b55 into main Jun 22, 2026
9 checks passed
@paustint paustint deleted the fix/data-table-crash-regression branch June 22, 2026 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants