Revert "Fix loading _dynamicTabHeaderEndpoints in time under Polymer 2"
This reverts commit 027aaa76fe
.
Reason for revert: underlying issue was fixed in
I529812c45edecf584897a4168fde28835feb316e,
this is causing duplicated `showchange` event fired for plugins
Bug: Issue 11336
Change-Id: I4ba5c70590ed0d9e53a95a89f0ae93378ae76364
This commit is contained in:
@@ -304,7 +304,6 @@
|
||||
'_labelsChanged(_change.labels.*)',
|
||||
'_paramsAndChangeChanged(params, _change)',
|
||||
'_patchNumChanged(_patchRange.patchNum)',
|
||||
'_loadDynamicTabHeaderAndContent(_change, _selectedRevision)',
|
||||
],
|
||||
|
||||
keyboardShortcuts() {
|
||||
@@ -339,6 +338,17 @@
|
||||
this._setDiffViewMode();
|
||||
});
|
||||
|
||||
Gerrit.awaitPluginsLoaded().then(() => {
|
||||
this._dynamicTabHeaderEndpoints =
|
||||
Gerrit._endpoints.getDynamicEndpoints('change-view-tab-header');
|
||||
this._dynamicTabContentEndpoints =
|
||||
Gerrit._endpoints.getDynamicEndpoints('change-view-tab-content');
|
||||
if (this._dynamicTabContentEndpoints.length
|
||||
!== this._dynamicTabHeaderEndpoints.length) {
|
||||
console.warn('Different number of tab headers and tab content.');
|
||||
}
|
||||
}).then(() => this._setPrimaryTab());
|
||||
|
||||
this.addEventListener('comment-save', this._handleCommentSave.bind(this));
|
||||
this.addEventListener('comment-refresh', this._reloadDrafts.bind(this));
|
||||
this.addEventListener('comment-discard',
|
||||
@@ -751,17 +761,21 @@
|
||||
});
|
||||
},
|
||||
|
||||
_setPrimaryTab() {
|
||||
// Selected has to be set after the paper-tabs are visible because
|
||||
// the selected underline depends on calculations made by the browser.
|
||||
this.$.commentTabs.selected = 0;
|
||||
const primaryTabs = this.$$('#primaryTabs');
|
||||
if (primaryTabs) primaryTabs.selected = 0;
|
||||
},
|
||||
|
||||
_performPostLoadTasks() {
|
||||
this._maybeShowReplyDialog();
|
||||
this._maybeShowRevertDialog();
|
||||
|
||||
this._sendShowChangeEvent();
|
||||
|
||||
// Selected has to be set after the paper-tabs are visible because
|
||||
// the selected underline depends on calculations made by the browser.
|
||||
this.$.commentTabs.selected = 0;
|
||||
const primaryTabs = this.$$('#primaryTabs');
|
||||
if (primaryTabs) primaryTabs.selected = 0;
|
||||
this._setPrimaryTab();
|
||||
|
||||
this.async(() => {
|
||||
if (this.viewState.scrollTop) {
|
||||
@@ -774,41 +788,6 @@
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* We use an observer to observe 'change' and 'selectedRevision'
|
||||
* variables. This fixes an issue under Polymer 2 so that the dynamic
|
||||
* plugins loads when these variables load.
|
||||
*/
|
||||
_loadDynamicTabHeaderAndContent(change, selectedRevision) {
|
||||
// These vars are unused, but because primaryTabs extension point
|
||||
// uses it, we makes sure we doin't load the plugin until these vars
|
||||
// exist.
|
||||
if (!change || !selectedRevision) return;
|
||||
|
||||
// We cache the _dynamicTabHeaderEndpoints and _dynamicTabContentEndpoints
|
||||
// var so that we doin't keep loading the same dynamic plugin
|
||||
// over and over when 'change' or 'selectedRevision' change.
|
||||
if (this._dynamicTabHeaderEndpoints || this._dynamicTabContentEndpoints) {
|
||||
return;
|
||||
}
|
||||
|
||||
Gerrit.awaitPluginsLoaded().then(() => {
|
||||
this._dynamicTabHeaderEndpoints =
|
||||
Gerrit._endpoints.getDynamicEndpoints('change-view-tab-header');
|
||||
this._dynamicTabContentEndpoints =
|
||||
Gerrit._endpoints.getDynamicEndpoints('change-view-tab-content');
|
||||
if (this._dynamicTabContentEndpoints.length
|
||||
!== this._dynamicTabHeaderEndpoints.length) {
|
||||
console.warn('Different number of tab headers and tab content.');
|
||||
}
|
||||
}).then(() => {
|
||||
// We need a second then(..) to ensure that the dynamic endpoints
|
||||
// are created before we call _performPostLoadTasks(). This ensures it has
|
||||
// enough time before the primary tab gets selected.
|
||||
this._performPostLoadTasks();
|
||||
});
|
||||
},
|
||||
|
||||
_paramsAndChangeChanged(value, change) {
|
||||
// Polymer 2: check for undefined
|
||||
if ([value, change].some(arg => arg === undefined)) {
|
||||
|
Reference in New Issue
Block a user