fix(content): show a relation's title in the read view, not its id - #225
Merged
Conversation
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
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.
Summary
Closes #203.
The collapsed (read) view printed
authoras54fc50cee2b1while the edit form showedCollabers Editörü. The resolver from #192 was right; the display path was a third call site that never called it.useRelationLabels(model, locale)composable builds, per relation field, aref → titlemap with the samebuildRelationOptionsthe picker uses (declaredtitle_field, default-locale fallback for non-i18n targets,model::refkeys for polymorphic compounds). ContentPanel loads it once per model/locale/synced tree and provides it; the collection, singleton and document views inject it.ContentFieldDisplaygained arelationLabelsprop and a relation branch: titles as badges, capped at 8 with+N, an emptyrelationsarray 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.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 arrayuse-relation-labels.nuxt.test.ts— per-field maps, default-locale fallback, reload on tree change, no queries for relation-less modelsnuxt typecheck, fullpnpm test(157 files green)articlesandsite-settings, expand a row without the pencil —author,category,header_categories,ticker_articlesread as titles🤖 Generated with Claude Code
https://claude.ai/code/session_01Chid3TnLdPHjsKip4n63Ky