Skip to content

Commit

Permalink
fix(admin-ui): Fix error when saving Product
Browse files Browse the repository at this point in the history
A fix in v1.1.1 introduced a case where saving a Product would always fail when there were
"relation" custom fields defined on the ProductVariant entity.
  • Loading branch information
michaelbromley committed Jul 20, 2021
1 parent 25be31c commit dbf6c00
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export class ProductDetailService {

const productOldName = findTranslation(product, languageCode)?.name;
const productNewName = findTranslation(productInput, languageCode)?.name;
if (productOldName && productNewName && autoUpdate) {
if (productOldName && productNewName && productOldName !== productNewName && autoUpdate) {
for (const variant of product.variants) {
const currentVariantName = findTranslation(variant, languageCode)?.name || '';
let variantInput: UpdateProductVariantInput;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ function transformRelations<T>(input: T, customFieldConfig: CustomFieldConfig[])
}

function hasCustomFields(input: any): input is { customFields: { [key: string]: any } } {
return input != null && input.hasOwnProperty('customFields');
return input != null && input.hasOwnProperty('customFields') && typeof input.customFields === 'object';
}

0 comments on commit dbf6c00

Please sign in to comment.