Skip to content

Commit 538ee63

Browse files
Copilothotlong
andcommitted
address review: add TypeScript types, move CHANGELOG to Added section
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
1 parent 03b883d commit 538ee63

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10-
### Fixed
10+
### Added
1111

1212
- **ObjectDataTable: columns now support `string[]` shorthand** (`@object-ui/plugin-dashboard`): `ObjectDataTable` now normalizes `columns` entries so that both `string[]` (e.g. `['name', 'close_date']`) and `object[]` formats are accepted. String entries are automatically converted to `{ header, accessorKey }` objects with title-cased headers derived from snake_case and camelCase field names. Previously, passing a `string[]` caused the downstream `data-table` renderer to crash when accessing `col.accessorKey` on a plain string. Mixed arrays (some strings, some objects) are also handled correctly. Includes 8 new unit tests.
1313

14+
### Fixed
15+
1416
- **i18n loadLanguage Not Compatible with Spec REST API Response Format** (`apps/console`): Fixed `loadLanguage` in `apps/console/src/main.tsx` to correctly unwrap the `@objectstack/spec` REST API envelope `{ data: { locale, translations } }`. Previously, the function returned the raw JSON response, which meant `useObjectLabel` and `useObjectTranslation` hooks received a wrapped object instead of the flat translation map, causing business object and field labels (e.g., CRM contact/account) to fall back to English. The fix extracts `data.translations` when the spec envelope is detected, while preserving backward compatibility with mock/dev environments that return flat translation objects. Includes 6 unit tests covering spec envelope unwrapping, flat fallback, HTTP errors, network failures, and edge cases.
1517

1618
- **List Toolbar Action Buttons Not Responding** (`apps/console`): Fixed a bug where schema-driven action buttons in the upper-right corner of the list view (rendered via `action:bar` with `locations: ['list_toolbar']`) did not respond to clicks. The root cause: the console `ObjectView` component rendered these action buttons via `SchemaRenderer` without wrapping them in an `ActionProvider`. This caused `useAction()` to fall back to a local `ActionRunner` with no handlers, toast, confirmation, or navigation capabilities — so clicks executed silently with no visible effect. Added `ActionProvider` with proper handlers (toast via Sonner, confirmation dialog, navigation via React Router, param collection dialog, and a generic API handler) to the console `ObjectView`, following the same pattern already used in `RecordDetailView`. Includes 4 new integration tests validating the full action chain (render, confirm, execute, cancel).

packages/plugin-dashboard/src/ObjectDataTable.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,21 @@ export interface ObjectDataTableProps {
2929
className?: string;
3030
}
3131

32+
/** A column definition after normalization, with header and accessor key. */
33+
interface NormalizedColumn {
34+
header: string;
35+
accessorKey: string;
36+
[key: string]: any;
37+
}
38+
3239
/**
3340
* Normalize columns to support both string[] shorthand and object[] formats.
3441
*
3542
* - `string[]` entries are converted to `{ header, accessorKey }` objects,
3643
* handling both snake_case and camelCase for header generation.
3744
* - Object entries are returned as-is.
3845
*/
39-
export function normalizeColumns(columns: any[]): any[] {
46+
export function normalizeColumns(columns: (string | Record<string, any>)[]): NormalizedColumn[] {
4047
return columns.map((col) => {
4148
if (typeof col === 'string') {
4249
return {

0 commit comments

Comments
 (0)