Skip to content

[6.x] Fix relationship-based fields showing raw ids after saving - #14948

Merged
jasonvarga merged 1 commit into
statamic:6.xfrom
mynetx:fix/relationship-stale-item-data
Jul 8, 2026
Merged

[6.x] Fix relationship-based fields showing raw ids after saving#14948
jasonvarga merged 1 commit into
statamic:6.xfrom
mynetx:fix/relationship-stale-item-data

Conversation

@mynetx

Copy link
Copy Markdown
Contributor

When a relationship/terms field is taggable and a newly typed term gets selected, the id it's stored under can change once the entry is saved (e.g. a typed "Bob" gets normalized to a taxonomy::slug id like tags::bob). Two things combine to turn that into a permanently wrong label:

  • RelationshipInput never refetches its item data when the value changes to reference an id it has no cached title for, so it falls back to displaying the raw id.
  • Even with correct item data, the underlying combobox always shows its plain search input for taggable fields, and derives that input's label from its own fetched options list rather than from the field's up-to-date items, so a selected id missing from that list also renders as the raw id.

Fixes#14785

This supersedes #14936, which addressed only the first part above and was closed for targeting 5.x rather than a correctness issue. Verified against the actual repro in a real browser (typing a new term, saving, checking the label survives) rather than just the reactive data flow — the first fix alone still left the raw id on screen, which is what led to finding the second bug in the combobox itself.

🤖 Generated with Claude Code

When a relationship/terms field is taggable and a newly typed term gets
selected, the id it's stored under can change once the entry is saved
(e.g. a typed "Bob" gets normalized to a taxonomy::slug id like
tags::bob). Two things combine to turn that into a permanently wrong
label:
- RelationshipInput never refetches its item data when the value
changes to reference an id it has no cached title for, so it falls
back to displaying the raw id.
- Even with correct item data, the underlying Combobox always shows
its plain search input for taggable fields, and derives that
input's label from its own fetched options list rather than from
the field's up-to-date items, so a selected id missing from that
list also renders as the raw id.
Refetch item data whenever the value references an id missing from it,
and make sure the combobox's own option list always includes the
currently selected item so its label lookup can resolve it.
Fixesstatamic#14785
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jasonvarga
jasonvarga merged commit aa49838 into statamic:6.xJul 8, 2026
20 checks passed
Sign up for freeto 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.

Taxonomy Terms field shows wrong label when limited to single term

2 participants

@mynetx@jasonvarga