Page MenuHomePhabricator

CX puts unnecessary burden on many page views
Closed, ResolvedPublic

Description

Since c608f056e94e4945c243d2430429470793153dbc, we have introduced OOUI usage on many page views, since the library was needed for new dialog which T217827 required.
The commit message of that patch claims to have optimization: "Do not load any CX module unnecessarily till we are sure that a gray interlanguage link is displayed. For this an init module is introduced". However, we actually load heavy interlanguage JS file, which has dependency on OOUI, when some possible target languages are discovered for user. For this "discovery", we check browser languages, previous ULS selections, etc.
Then, if all languages, determined by such algorithm, have article in their wikis, gray interlanguage links will not show at all, but we'll have script file, which should handle clicks on these gray links, loaded, as well with OOUI needed for that dialog, which will obviously never be displayed.

Also, if gray links are showing, we still don't need to load the script with OOUI dependency, since user may not utilize gray links often, but will read a lot, which just puts a burden on pages to handle actions user may never take. With little compromise of UX, we could load the dialog script (which has OOUI dependency) at time when user clicks gray link.

Details

Related Gerrit Patches:
mediawiki/extensions/ContentTranslation : masterOptimize when ext.cx.interlanguagelink is loaded

Event Timeline

Change 534984 had a related patch set uploaded (by Petar.petkovic; owner: Petar.petkovic):
[mediawiki/extensions/ContentTranslation@master] Optimize when ext.cx.interlanguagelink is loaded

https://gerrit.wikimedia.org/r/534984

Change 534984 merged by jenkins-bot:
[mediawiki/extensions/ContentTranslation@master] Optimize when ext.cx.interlanguagelink is loaded

https://gerrit.wikimedia.org/r/534984

Petar.petkovic added a subscriber: Jpita.

@Jpita let me clarify what you should look after in next release.

The change we brought is that ext.cx.interlanguagelink.js file is no longer sent to client unless we are sure gray interlanguage links will be shown. To check if this file is loaded, open DevTools and check if mw.cx.createCXInterlanguageItem method exists in the console.

One example of article which is highly unlikely to show any gray links is en:Finland. On the other hand, gray links will easily show for any article that does not exist in other languages, e.g. List of 2009 box office number-one films in Belgium.

You can check the behavior before and after this change is released in production.

Jpita closed this task as Resolved.Sep 25 2019, 2:13 PM
Jpita moved this task from Needs QA to Done on the Language-Team (Language-2019-July-September) board.