feat(plugin-dashboard): ObjectDataTable columns support string[] shorthand#1103
Merged
feat(plugin-dashboard): ObjectDataTable columns support string[] shorthand#1103
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
ObjectDataTable now supports both string[] shorthand and object[] formats
for column configuration. String entries like 'close_date' are auto-converted
to { header: 'Close Date', accessorKey: 'close_date' }. Handles snake_case,
camelCase, and mixed arrays. Fixes #303.
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Agent-Logs-Url: https://github.com/objectstack-ai/objectui/sessions/de8fa9da-2f3d-4641-b43f-330b65eee7db
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com> Agent-Logs-Url: https://github.com/objectstack-ai/objectui/sessions/de8fa9da-2f3d-4641-b43f-330b65eee7db
Copilot
AI
changed the title
[WIP] Fix ObjectDataTable to normalize columns from string array
feat(plugin-dashboard): ObjectDataTable columns support string[] shorthand
Mar 21, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds string[] shorthand support for ObjectDataTable columns by normalizing entries into { header, accessorKey } objects, preventing downstream data-table crashes and improving header generation.
Changes:
- Introduced
normalizeColumns()to convert string column keys into full column defs (supports mixedstring | objectarrays). - Updated
ObjectDataTableto pass normalized columns to thedata-tablerenderer. - Added unit tests for
normalizeColumnsplus component-level regression tests, and documented the feature in the changelog.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/plugin-dashboard/src/ObjectDataTable.tsx | Normalizes schema.columns so string[] shorthand doesn’t crash downstream renderers. |
| packages/plugin-dashboard/src/tests/ObjectDataTable.test.tsx | Adds regression coverage for string[] columns and direct tests for normalization behavior. |
| CHANGELOG.md | Documents the new string[] shorthand support for ObjectDataTable columns. |
Comments suppressed due to low confidence (1)
packages/plugin-dashboard/src/ObjectDataTable.tsx:143
- The auto-derived column headers (when
schema.columnsis empty) still don't normalize snake_case keys (e.g.close_datebecomesClose_date) and use a different casing algorithm thannormalizeColumns. Consider reusingnormalizeColumnsfor the auto-derive path (e.g. by passingkeysthrough it) to keep header derivation consistent and avoid duplicated formatting logic.
}
if (finalData.length === 0) return [];
// Exclude internal/private fields (prefixed with '_') from auto-derived columns
const keys = Object.keys(finalData[0]).filter(k => !k.startsWith('_'));
// Convert camelCase keys to human-readable headers (e.g. firstName → First Name)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ObjectDataTablecrashes whencolumnsis astring[](e.g.['name', 'amount']) becausederivedColumnspasses strings straight through to thedata-tablerenderer, which accessescol.accessorKeyon a plain string →undefined.Changes
normalizeColumnshelper inObjectDataTable.tsx— maps each string entry to{ header, accessorKey }, passes objects through unchanged. Handles per-element normalization so mixed arrays work too.close_date→Close Date) and camelCase (firstName→First Name) both title-cased correctly.normalizeColumns, 2 integration tests for the component with string columns.Usage
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.