this.requestCounter = {};
this.baseFilterState = {};
this.uriProcessor = null;
- this.initializing = false;
+ this.initialized = false;
this.wereSavedQueriesSaved = false;
this.prevLoggedItems = [];
}
}
- // Check whether we need to load defaults.
- // We do this by checking whether the current URI query
- // contains any parameters recognized by the system.
- // If it does, we load the given state.
- // If it doesn't, we have no values at all, and we assume
- // the user loads the base-page and we load defaults.
- // Defaults should only be applied on load (if necessary)
- // or on request
- this.initializing = true;
-
if ( defaultSavedQueryExists ) {
// This came from the server, meaning that we have a default
// saved query, but the server could not load it, probably because
);
}
- this.initializing = false;
+ this.initialized = true;
this.switchView( 'default' );
this.pollingRate = mw.config.get( 'StructuredChangeFiltersLiveUpdatePollingRate' );
}
};
+ /**
+ * Check if the controller has finished initializing.
+ * @return {boolean} Controller is initialized
+ */
+ mw.rcfilters.Controller.prototype.isInitialized = function () {
+ return this.initialized;
+ };
+
/**
* Extracts information from the changes list DOM
*
this.changesListViewModel = changesListViewModel;
this.controller = controller;
this.highlightClasses = null;
- this.filtersModelInitialized = false;
// Events
this.filtersViewModel.connect( this, {
itemUpdate: 'onItemUpdate',
- highlightChange: 'onHighlightChange',
- initialize: 'onFiltersModelInitialize'
+ highlightChange: 'onHighlightChange'
} );
this.changesListViewModel.connect( this, {
invalidate: 'onModelInvalidate',
OO.inheritClass( mw.rcfilters.ui.ChangesListWrapperWidget, OO.ui.Widget );
- /**
- * Respond to filters model initialize event
- */
- mw.rcfilters.ui.ChangesListWrapperWidget.prototype.onFiltersModelInitialize = function () {
- this.filtersModelInitialized = true;
- };
-
/**
* Get all available highlight classes
*
* Respond to a filter item model update
*/
mw.rcfilters.ui.ChangesListWrapperWidget.prototype.onItemUpdate = function () {
- if ( this.filtersModelInitialized && this.filtersViewModel.isHighlightEnabled() ) {
+ if ( this.controller.isInitialized() && this.filtersViewModel.isHighlightEnabled() ) {
+ // this.controller.isInitialized() is still false during page load,
+ // we don't want to clear/apply highlights at this stage.
this.clearHighlight();
this.applyHighlight();
}