diff --git a/packages/admin-ui/src/lib/core/src/data/utils/transform-relation-custom-field-inputs.ts b/packages/admin-ui/src/lib/core/src/data/utils/transform-relation-custom-field-inputs.ts index 781816aa37..ce916e56a1 100644 --- a/packages/admin-ui/src/lib/core/src/data/utils/transform-relation-custom-field-inputs.ts +++ b/packages/admin-ui/src/lib/core/src/data/utils/transform-relation-custom-field-inputs.ts @@ -8,7 +8,7 @@ import { CustomFieldConfig } from '../../common/generated-types'; * as expected by the server. */ export function transformRelationCustomFieldInputs< - T extends { input?: Record | Array> } & Record = any + T extends { input?: Record | Array> } & Record = any, >(variables: T, customFieldConfig: CustomFieldConfig[]): T { if (variables.input) { if (Array.isArray(variables.input)) { @@ -36,7 +36,7 @@ function transformRelations(input: T, customFieldConfig: CustomFieldConfig[]) delete input.customFields[field.name]; input.customFields[getGraphQlInputName(field)] = field.list && Array.isArray(entityValue) - ? entityValue.map(v => v?.id) + ? entityValue.map(v => (typeof v === 'string' ? v : v?.id)) : entityValue === null ? null : entityValue?.id; diff --git a/packages/admin-ui/src/lib/core/src/shared/dynamic-form-inputs/product-multi-selector-form-input/product-multi-selector-form-input.component.ts b/packages/admin-ui/src/lib/core/src/shared/dynamic-form-inputs/product-multi-selector-form-input/product-multi-selector-form-input.component.ts index 40a7c32fa0..3c3119ed6f 100644 --- a/packages/admin-ui/src/lib/core/src/shared/dynamic-form-inputs/product-multi-selector-form-input/product-multi-selector-form-input.component.ts +++ b/packages/admin-ui/src/lib/core/src/shared/dynamic-form-inputs/product-multi-selector-form-input/product-multi-selector-form-input.component.ts @@ -37,7 +37,9 @@ export class ProductMultiSelectorFormInputComponent implements OnInit, FormInput size: 'xl', locals: { mode: this.mode, - initialSelectionIds: this.formControl.value, + initialSelectionIds: this.formControl.value.map(item => + typeof item === 'string' ? item : item.id, + ), }, }) .subscribe(selection => { @@ -47,6 +49,7 @@ export class ProductMultiSelectorFormInputComponent implements OnInit, FormInput this.mode === 'product' ? item.productId : item.productVariantId, ), ); + this.formControl.markAsDirty(); this.changeDetector.markForCheck(); } });