Skip to content

Commit 93b8c90

Browse files
committed
PB-235: Story Bug for PB-107: Adding Condition Filter will Not Update Total until After Saving Edit Form & Reopening
1 parent c3c280e commit 93b8c90

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

app/code/Magento/PageBuilder/view/adminhtml/web/js/form/element/product-totals.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ define([
1919
formData: {},
2020
totalProductCount: 0,
2121
totalDisabledProducts: 0,
22+
category_ids: '',
2223
listens: {
2324
conditionOption: 'updateProductTotals',
2425
conditionValue: 'updateProductTotals',
26+
formData: 'updateProductTotals'
2527
},
2628
imports: {
2729
formData: '${ $.provider }:data'
@@ -46,14 +48,17 @@ define([
4648
*
4749
*/
4850
updateProductTotals: _.debounce(function () {
49-
if (!this.conditionOption || _.isEmpty(this.formData)) {
51+
if (!this.conditionOption || _.isEmpty(this.formData) ||
52+
(this.conditionOption === 'category_ids' && this.category_ids === this.formData['category_ids'])) {
5053
return;
5154
}
5255

53-
if (this.conditionOption === 'category_ids' && typeof this.formData[this.conditionOption] != "string") {
54-
this.formData[this.conditionOption] = '';
56+
if (this.conditionOption === 'category_ids' && typeof this.formData['category_ids'] != "string") {
57+
this.formData['category_ids'] = '';
5558
}
5659

60+
this.category_ids = this.conditionOption === 'category_ids' ? this.formData['category_ids'] : '';
61+
5762
_.extend(this.formData, this.conditionValue);
5863
conditionsDataProcessor(this.formData, this.conditionOption + '_source');
5964

0 commit comments

Comments
 (0)