[6.x] Fix relationship-based fields showing raw ids after saving#14948
Open
mynetx wants to merge 1 commit into
Open
[6.x] Fix relationship-based fields showing raw ids after saving#14948mynetx wants to merge 1 commit into
mynetx wants to merge 1 commit into
Conversation
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>
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.
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:RelationshipInputnever 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.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