From 80d91cdd927426efa22e6268c8eaa49a2d84d77d Mon Sep 17 00:00:00 2001 From: melohagan <101575380+melohagan@users.noreply.github.com> Date: Thu, 28 Sep 2023 16:09:13 +0100 Subject: [PATCH] Make sure field state is valid (#11921) --- .../src/components/app/forms/RelationshipField.svelte | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/client/src/components/app/forms/RelationshipField.svelte b/packages/client/src/components/app/forms/RelationshipField.svelte index 768f784d49..bfa7c6cbd2 100644 --- a/packages/client/src/components/app/forms/RelationshipField.svelte +++ b/packages/client/src/components/app/forms/RelationshipField.svelte @@ -121,7 +121,12 @@ if (!Array.isArray(values)) { values = [values] } - return values.map(value => (typeof value === "object" ? value._id : value)) + values = values.map(value => + typeof value === "object" ? value._id : value + ) + // Make sure field state is valid + fieldApi.setValue(values) + return values } const getDisplayName = row => {