u
This commit is contained in:
@@ -184,13 +184,14 @@ export default class ArticleAttributesTab extends PureComponent {
|
||||
return;
|
||||
}
|
||||
|
||||
let nextValues = [];
|
||||
if (isExclusive) {
|
||||
const others = assignedAttributes.filter((a) => a.attributeId !== targetAttr.id);
|
||||
nextValues = [...others.map((a) => a.attributeValueId), targetValId];
|
||||
} else {
|
||||
nextValues = [...assignedAttributes.map((a) => a.attributeValueId), targetValId];
|
||||
}
|
||||
const nextValues = isExclusive
|
||||
? [
|
||||
...assignedAttributes
|
||||
.filter((a) => a.attributeId !== targetAttr.id)
|
||||
.map((a) => a.attributeValueId),
|
||||
targetValId,
|
||||
]
|
||||
: [...assignedAttributes.map((a) => a.attributeValueId), targetValId];
|
||||
|
||||
this.setState({ saving: true });
|
||||
try {
|
||||
@@ -222,19 +223,13 @@ export default class ArticleAttributesTab extends PureComponent {
|
||||
return;
|
||||
}
|
||||
}
|
||||
let nextProps = [];
|
||||
if (isExclusive) {
|
||||
const existing = assignedProperties.filter((p) => p.propertyId !== propId);
|
||||
nextProps = [
|
||||
...existing.map((p) => ({ propertyId: p.propertyId, value: p.value, sort: p.sort })),
|
||||
{ propertyId: propId, value: val },
|
||||
];
|
||||
} else {
|
||||
nextProps = [
|
||||
...assignedProperties.map((p) => ({ propertyId: p.propertyId, value: p.value, sort: p.sort })),
|
||||
{ propertyId: propId, value: val },
|
||||
];
|
||||
}
|
||||
const sourceProps = isExclusive
|
||||
? assignedProperties.filter((p) => p.propertyId !== propId)
|
||||
: assignedProperties;
|
||||
const nextProps = [
|
||||
...sourceProps.map((p) => ({ propertyId: p.propertyId, value: p.value, sort: p.sort })),
|
||||
{ propertyId: propId, value: val },
|
||||
];
|
||||
|
||||
this.setState({ saving: true });
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user