Skip to content

fix(content): show a relation's title in the read view, not its id - #225

Merged
ABB65 merged 1 commit into
mainfrom
fix/read-view-relation-labels
Sep 2, 2026
Merged

fix(content): show a relation's title in the read view, not its id#225
ABB65 merged 1 commit into
mainfrom
fix/read-view-relation-labels

Conversation

@ABB65

@ABB65 ABB65 commented Sep 2, 2026

Copy link
Copy Markdown
Member

Summary

Closes #203.

The collapsed (read) view printed author as 54fc50cee2b1 while the edit form showed Collabers Editörü. The resolver from #192 was right; the display path was a third call site that never called it.

  • One source for relation titles. New useRelationLabels(model, locale) composable builds, per relation field, a ref → title map with the same buildRelationOptions the picker uses (declared title_field, default-locale fallback for non-i18n targets, model::ref keys for polymorphic compounds). ContentPanel loads it once per model/locale/synced tree and provides it; the collection, singleton and document views inject it.
  • ContentFieldDisplay gained a relationLabels prop and a relation branch: titles as badges, capped at 8 with +N, an empty relations array reads as . A ref whose target is missing is shown as itself in mono with a "no longer exists" title — the one case where the id is the honest answer.
  • The collection view's private loader (it fed the filter axes only) is removed; the axes read the shared map. Reload is keyed on brain.treeSha, so a renamed target shows its new title after the next sync.

Test plan

  • content-field-display.nuxt.test.ts — single relation, relations array, missing target fallback, polymorphic key, empty array
  • use-relation-labels.nuxt.test.ts — per-field maps, default-locale fallback, reload on tree change, no queries for relation-less models
  • lint, nuxt typecheck, full pnpm test (157 files green)
  • Staging: open articles and site-settings, expand a row without the pencil — author, category, header_categories, ticker_articles read as titles

🤖 Generated with Claude Code

https://claude.ai/code/session_01Chid3TnLdPHjsKip4n63Ky

The collapsed view of an entry printed relation fields as raw entry
ids while the edit form for the same entry resolved them to titles.
The resolver existed and was right; the display path never called it.
Editors landed on a wall of hex, opened the modal to learn what a row
pointed at, then cancelled.

Relation labels now come from one place, `useRelationLabels`: loaded
by ContentPanel once per model, locale and synced tree, built with the
same `buildRelationOptions` the picker uses, and provided to the
collection, singleton and document views. ContentFieldDisplay gained a
relation branch that shows the target's title and falls back to the
raw ref, in mono, only when the target is missing. The collection
view's private copy of the loader (filter axes only) is gone; the axes
read the shared map.

Closes #203
@ABB65
ABB65 merged commit 91848b4 into main Sep 2, 2026
2 checks passed
@ABB65
ABB65 deleted the fix/read-view-relation-labels branch September 2, 2026 09:07
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.

Read view shows raw relation IDs while the edit form resolves them

1 participant