This commit is contained in:
seb
2026-10-04 08:18:36 +02:00
parent f2fce9097b
commit 4edd417dab
19 changed files with 141 additions and 220 deletions

View File

@@ -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 {