Skip to content

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

Open
mynetx wants to merge 1 commit into
statamic:6.xfrom
mynetx:fix/relationship-stale-item-data
Open

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

Conversation

@mynetx

@mynetx mynetx commented Jul 6, 2026

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.

Fixes statamic#14785

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

Taxonomy Terms field shows wrong label when limited to single term

1 participant