Popups doesn't need to depend on EventLogging

When EventLogging is unavailable do not initialise the EL-related code
or try to send any events.

When EL is enabled for a brand new user we request an additional module
during boot causing an additional HTTP request. Page Previews continues
to boot normally regardless of whether the request fails.

This approach doesn't impact boot or first paint time. Once the module
is loaded once it should be cached locally, subject to the
ResourceLoader's policy. Moreover, the RL will not attempt to load the
module twice so this doesn't impact the performance of other modules.

Bug: T158999
Change-Id: I7ed7f00d52279151ece23e5aced4f2adb0f7fdc3
This commit is contained in:
jdlrobson 2017-03-16 14:03:21 -07:00 committed by Sam Smith
parent cb4cdc868a
commit b01e11c1f9
4 changed files with 9 additions and 7 deletions

View file

@ -115,8 +115,7 @@
"mediawiki.ui.button",
"mediawiki.ui.icon",
"mediawiki.Uri",
"jquery.hidpi",
"ext.eventLogging.Schema"
"jquery.hidpi"
]
}
},

Binary file not shown.

Binary file not shown.

View file

@ -49,18 +49,16 @@ function createGateway( config ) {
*
* @param {Redux.Store} store
* @param {Object} actions
* @param {mw.eventLog.Schema} schema
* @param {ext.popups.UserSettings} userSettings
* @param {Function} settingsDialog
* @param {ext.popups.PreviewBehavior} previewBehavior
* @param {bool} isStatsvLoggingEnabled
* @param {Function} track mw.track
*/
function registerChangeListeners( store, actions, schema, userSettings, settingsDialog, previewBehavior, isStatsvLoggingEnabled, track ) {
function registerChangeListeners( store, actions, userSettings, settingsDialog, previewBehavior, isStatsvLoggingEnabled, track ) {
registerChangeListener( store, changeListeners.footerLink( actions ) );
registerChangeListener( store, changeListeners.linkTitle() );
registerChangeListener( store, changeListeners.render( previewBehavior ) );
registerChangeListener( store, changeListeners.eventLogging( actions, schema ) );
registerChangeListener( store, changeListeners.statsv( actions, isStatsvLoggingEnabled, track ) );
registerChangeListener( store, changeListeners.syncUserSettings( userSettings ) );
registerChangeListener( store, changeListeners.settings( actions, settingsDialog ) );
@ -93,7 +91,6 @@ mw.requestIdleCallback( function () {
userSettings = createUserSettings( mw.storage );
settingsDialog = createSettingsDialogRenderer();
schema = createSchema( mw.config, window );
isStatsvLoggingEnabled = statsvInstrumentation.isEnabled( mw.user, mw.config, mw.experiments );
isEnabled = createIsEnabled( mw.user, userSettings, mw.config, mw.experiments );
@ -115,10 +112,16 @@ mw.requestIdleCallback( function () {
previewBehavior = createPreviewBehavior( mw.config, mw.user, boundActions );
registerChangeListeners(
store, boundActions, schema, userSettings, settingsDialog,
store, boundActions, userSettings, settingsDialog,
previewBehavior, isStatsvLoggingEnabled, mw.track
);
// Load EventLogging schema if possible...
mw.loader.using( 'ext.eventLogging.Schema' ).done( function () {
schema = createSchema( mw.config, window );
registerChangeListener( store, changeListeners.eventLogging( boundActions, schema ) );
} );
boundActions.boot(
isEnabled,
mw.user,