From 6df75c0f172b6050a2b57e8602c14f780b46fabd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joachim=20R=C3=BCtter?= Date: Fri, 3 Jul 2026 22:54:42 +0000 Subject: [PATCH] Fix relationship-based fields showing raw ids after saving MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .../inputs/relationship/RelationshipInput.vue | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/resources/js/components/inputs/relationship/RelationshipInput.vue b/resources/js/components/inputs/relationship/RelationshipInput.vue index f862a0f5bf8..e2c6f704b73 100644 --- a/resources/js/components/inputs/relationship/RelationshipInput.vue +++ b/resources/js/components/inputs/relationship/RelationshipInput.vue @@ -234,6 +234,16 @@ export default { itemData(data, olddata) { if (this.initializing) return; this.$emit('item-data-updated', data); + }, + + value(value) { + if (this.initializing || this.loading) return; + + // Values set from outside (e.g. from a save response, where a new term's id gets + // normalized) may reference items we have no data for, which would display raw ids. + if (value?.some(selection => !_.find(this.data, (item) => item.id == selection))) { + this.getDataForSelections(value); + } } },