mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-27 17:00:37 +00:00
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:
parent
cb4cdc868a
commit
b01e11c1f9
|
@ -115,8 +115,7 @@
|
|||
"mediawiki.ui.button",
|
||||
"mediawiki.ui.icon",
|
||||
"mediawiki.Uri",
|
||||
"jquery.hidpi",
|
||||
"ext.eventLogging.Schema"
|
||||
"jquery.hidpi"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
BIN
resources/dist/index.js
vendored
BIN
resources/dist/index.js
vendored
Binary file not shown.
BIN
resources/dist/index.js.map
vendored
BIN
resources/dist/index.js.map
vendored
Binary file not shown.
13
src/index.js
13
src/index.js
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue