[5.x] Fix relationship-based fields showing raw ids after saving#14936
Open
mynetx wants to merge 1 commit into
Open
[5.x] Fix relationship-based fields showing raw ids after saving#14936mynetx wants to merge 1 commit into
mynetx wants to merge 1 commit into
Conversation
When the publish form resets values from a save response, ids may come back in a different form than what the client selected — most visibly when typing a new term into a single-term select field, where the typed text gets normalized to a taxonomy::slug id the component has no item data for. The item then renders its raw id instead of its title until a full reload. Refetch item data whenever the value references items missing from it.
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 you type a new term into a terms field (max_items 1, select or typeahead mode) and save, the field switches to showing the raw id (e.g.
tags::bob) instead of the label until you reload. The publish form resets the values from the save response, where the typed text has been normalized to ataxonomy::slugid — but the relationship input's item data is never refreshed, so it can't resolve a title for the new id and falls back to displaying the id itself.This makes the relationship input refetch its item data whenever the value references items it has no data for. That also heals the other stale-item-data paths reported in the issue (e.g. inside grids), since the input now recovers by itself instead of relying on the meta staying in sync.
Fixes #14785