Skip to content

Commit 8d5b01f

Browse files
committed
MC-3917: Reset button doesn't work
1 parent c14c328 commit 8d5b01f

File tree

1 file changed

+3
-51
lines changed

1 file changed

+3
-51
lines changed

app/code/Magento/PageBuilder/view/adminhtml/web/js/form/element/block-chooser.js

Lines changed: 3 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ define([
1818
meta: {},
1919
errorMessage: null,
2020
displayMetadata: true,
21-
initialValue: {},
2221
messages: {
2322
UNKOWN_ERROR: $t('Sorry, there was an error getting requested content. ' +
2423
'Please contact the store owner.'),
@@ -44,61 +43,16 @@ define([
4443
}
4544
},
4645
listens: {
47-
id: 'updateFromServer',
48-
'${ $.provider }:data.reset': 'reset'
46+
id: 'updateFromServer'
4947
}
5048
},
5149

52-
/**
53-
* Invokes initialize method of parent class,
54-
* contains initialization logic
55-
*/
56-
initialize: function () {
57-
_.bindAll(this, 'reset');
58-
59-
this._super()
60-
.setInitialValue();
61-
62-
return this;
63-
},
64-
65-
/**
66-
* Sets initial value of the element and subscribes to it's changes.
67-
*
68-
* @returns {Abstract} Chainable.
69-
*/
70-
setInitialValue: function () {
71-
if (this.id()) {
72-
this.initialValue(false);
73-
}
74-
return this;
75-
},
76-
7750
/**
7851
* @inheritdoc
7952
*/
8053
initObservable: function () {
8154
return this._super()
82-
.observe('id meta errorMessage displayMetadata initialValue');
83-
},
84-
85-
/**
86-
* Resets metadata
87-
*
88-
* @returns void
89-
*/
90-
reset: function () {
91-
this.meta(this.initialValue());
92-
this.errorMessage(null);
93-
},
94-
95-
/**
96-
* Resets metadata
97-
*
98-
* @returns void
99-
*/
100-
reset: function () {
101-
this.meta({});
55+
.observe('id meta errorMessage displayMetadata');
10256
},
10357

10458
/**
@@ -111,6 +65,7 @@ define([
11165

11266
// The component hasn't be configured yet. Nothing to do.
11367
if (!this.id() || !this.requestParameter || !this.dataUrlConfigPath) {
68+
this.meta({});
11469
return;
11570
}
11671

@@ -136,9 +91,6 @@ define([
13691
}
13792

13893
this.meta(response);
139-
if (this.initialValue() === false) {
140-
this.initialValue(response)
141-
}
14294
}.bind(this))
14395
.fail(function () {
14496
this.meta({});

0 commit comments

Comments
 (0)