Skip to content

Commit 1d0a531

Browse files
Copilothotlong
andcommitted
fix: address code review comments and update ROADMAP.md
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 46d5248 commit 1d0a531

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

ROADMAP.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,6 +1349,26 @@ All 313 `@object-ui/fields` tests pass.
13491349

13501350
---
13511351

1352+
### ListView/DetailView/DetailSection — Lookup Field & Type Display Consistency (March 2026)
1353+
1354+
> **Issue #939:** Lookup/master_detail fields displayed raw IDs (e.g. `o1`, `p1`) instead of expanded names across ListView, DetailView, and DetailSection.
1355+
1356+
**Root Causes:**
1357+
1358+
1. **ListView `$expand` race condition**`expandFields` depended on async `objectDef` which could be `null` on first fetch, causing data to be requested without `$expand` and returning raw foreign-key IDs.
1359+
2. **DetailView missing `$expand` and objectSchema**`findOne()` was called without `$expand` parameters and without loading `objectSchema`, so lookup fields could never be expanded.
1360+
3. **DetailSection missing objectSchema enrichment** — When `field.type` was not explicitly set, `displayValue` fell through to `String(value)`, bypassing type-aware CellRenderers even when objectSchema metadata was available.
1361+
1362+
**Fix:**
1363+
1364+
- **ListView** (`packages/plugin-list/src/ListView.tsx`): Added `objectDefLoaded` state flag. Data fetch effect is gated on `objectDefLoaded` so the first fetch always includes correct `$expand` parameters. The `objectDef` fetch effect sets the flag in `finally` block to handle both success and error cases.
1365+
- **DetailView** (`packages/plugin-detail/src/DetailView.tsx`): Added `objectSchema` state. Data fetch effect now calls `getObjectSchema()` first, computes `$expand` via `buildExpandFields()`, and passes the params to `findOne()`. The resolved `objectSchema` is passed to `DetailSection` components.
1366+
- **DetailSection** (`packages/plugin-detail/src/DetailSection.tsx`): Added optional `objectSchema` prop. When `field.type` is not set, the field is enriched with type, options, currency, precision, format, reference_to, and reference_field from `objectSchema` before selecting a CellRenderer. Explicit `field.type` always takes precedence over objectSchema.
1367+
1368+
**Tests:** 7 new tests added (2 ListView, 3 DetailView, 4 DetailSection). All 505 plugin-detail + plugin-list tests pass.
1369+
1370+
---
1371+
13521372
## ⚠️ Risk Management
13531373

13541374
| Risk | Mitigation |

packages/plugin-detail/src/DetailView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export const DetailView: React.FC<DetailViewProps> = ({
9393
const resourceId = schema.resourceId;
9494
const prefix = `${objectName}-`;
9595

96-
// Collect all visible field names from sections and top-level fields
96+
// Collect all visible fields from sections and top-level fields
9797
const allFields = [
9898
...(schema.sections?.flatMap(s => s.fields) || []),
9999
...(schema.fields || []),

0 commit comments

Comments
 (0)