u
This commit is contained in:
@@ -366,22 +366,20 @@ export default class ArticleViewLists extends PureComponent {
|
||||
const count = Math.max(1, Number(stuecklisteCount) || 1);
|
||||
|
||||
const existingIndex = currentItems.findIndex((i) => i.sku === stuecklisteTargetArticle.sku);
|
||||
let nextItems = [];
|
||||
if (existingIndex >= 0) {
|
||||
nextItems = currentItems.map((item, idx) =>
|
||||
idx === existingIndex ? { ...item, count: item.count + count } : item
|
||||
);
|
||||
} else {
|
||||
nextItems = [
|
||||
...currentItems,
|
||||
{
|
||||
articleId: stuecklisteTargetArticle.id,
|
||||
sku: stuecklisteTargetArticle.sku,
|
||||
count,
|
||||
sort: currentItems.length,
|
||||
},
|
||||
];
|
||||
}
|
||||
const nextItems =
|
||||
existingIndex >= 0
|
||||
? currentItems.map((item, idx) =>
|
||||
idx === existingIndex ? { ...item, count: item.count + count } : item
|
||||
)
|
||||
: [
|
||||
...currentItems,
|
||||
{
|
||||
articleId: stuecklisteTargetArticle.id,
|
||||
sku: stuecklisteTargetArticle.sku,
|
||||
count,
|
||||
sort: currentItems.length,
|
||||
},
|
||||
];
|
||||
|
||||
this.setState({ busy: true });
|
||||
try {
|
||||
@@ -492,25 +490,23 @@ export default class ArticleViewLists extends PureComponent {
|
||||
const count = Math.max(1, Number(optionCount) || 1);
|
||||
|
||||
const existingIndex = currentOptions.findIndex((o) => o.sku === optionTargetArticle.sku);
|
||||
let nextOptions = [];
|
||||
if (existingIndex >= 0) {
|
||||
nextOptions = currentOptions.map((opt, idx) =>
|
||||
idx === existingIndex
|
||||
? { ...opt, count: opt.count + count, mandated: Boolean(optionMandated) }
|
||||
: opt
|
||||
);
|
||||
} else {
|
||||
nextOptions = [
|
||||
...currentOptions,
|
||||
{
|
||||
articleId: optionTargetArticle.id,
|
||||
sku: optionTargetArticle.sku,
|
||||
count,
|
||||
sort: currentOptions.length,
|
||||
mandated: Boolean(optionMandated),
|
||||
},
|
||||
];
|
||||
}
|
||||
const nextOptions =
|
||||
existingIndex >= 0
|
||||
? currentOptions.map((opt, idx) =>
|
||||
idx === existingIndex
|
||||
? { ...opt, count: opt.count + count, mandated: Boolean(optionMandated) }
|
||||
: opt
|
||||
)
|
||||
: [
|
||||
...currentOptions,
|
||||
{
|
||||
articleId: optionTargetArticle.id,
|
||||
sku: optionTargetArticle.sku,
|
||||
count,
|
||||
sort: currentOptions.length,
|
||||
mandated: Boolean(optionMandated),
|
||||
},
|
||||
];
|
||||
|
||||
this.setState({ busy: true });
|
||||
try {
|
||||
@@ -1363,15 +1359,9 @@ export default class ArticleViewLists extends PureComponent {
|
||||
busy,
|
||||
activeCreatorMode,
|
||||
activeListTab,
|
||||
selectedAttributeId,
|
||||
selectedChildValueId,
|
||||
newChildText,
|
||||
isCustomChildValue,
|
||||
stuecklisteTargetArticle,
|
||||
stuecklisteCount,
|
||||
optionTargetArticle,
|
||||
optionCount,
|
||||
optionMandated,
|
||||
removeTargetChild,
|
||||
confirmClearType,
|
||||
} = this.state;
|
||||
|
||||
Reference in New Issue
Block a user