From 34135c76432c325fa62f2317acc5772bb04ad166 Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Sat, 2 Jul 2016 17:38:53 +0100 Subject: [PATCH] Ensure widgets are always torn down when categories page is closed Previously a return statement meant they weren't. Bug: T139196 Change-Id: Ic7bc14a929430ac6e9d2546fc9e1a1a02635ca77 --- .../ve-mw/ui/pages/ve.ui.MWCategoriesPage.js | 37 +++++++++---------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/modules/ve-mw/ui/pages/ve.ui.MWCategoriesPage.js b/modules/ve-mw/ui/pages/ve.ui.MWCategoriesPage.js index a6fc265c81..9d60ea40fa 100644 --- a/modules/ve-mw/ui/pages/ve.ui.MWCategoriesPage.js +++ b/modules/ve-mw/ui/pages/ve.ui.MWCategoriesPage.js @@ -282,26 +282,23 @@ ve.ui.MWCategoriesPage.prototype.teardown = function ( data ) { attributes: { content: newDefaultSortKey } }; - data = data || {}; - if ( data.action !== 'apply' ) { - return; - } - - // Alter the default sort key iff it's been touched & is actually different - if ( this.defaultSortKeyTouched ) { - if ( newDefaultSortKey === '' ) { - if ( currentDefaultSortKeyItem ) { - currentDefaultSortKeyItem.remove(); - } - } else { - if ( !currentDefaultSortKeyItem ) { - this.metaList.insertMeta( newDefaultSortKeyData ); - } else if ( currentDefaultSortKeyItem.getAttribute( 'content' ) !== newDefaultSortKey ) { - currentDefaultSortKeyItem.replaceWith( - ve.extendObject( true, {}, - currentDefaultSortKeyItem.getElement(), - newDefaultSortKeyData - ) ); + if ( data && data.action === 'apply' ) { + // Alter the default sort key iff it's been touched & is actually different + if ( this.defaultSortKeyTouched ) { + if ( newDefaultSortKey === '' ) { + if ( currentDefaultSortKeyItem ) { + currentDefaultSortKeyItem.remove(); + } + } else { + if ( !currentDefaultSortKeyItem ) { + this.metaList.insertMeta( newDefaultSortKeyData ); + } else if ( currentDefaultSortKeyItem.getAttribute( 'content' ) !== newDefaultSortKey ) { + currentDefaultSortKeyItem.replaceWith( + ve.extendObject( true, {}, + currentDefaultSortKeyItem.getElement(), + newDefaultSortKeyData + ) ); + } } } }