Page MenuHomePhabricator

MediaWiki Widgets module loads all modules instead of the only the desired one
Closed, ResolvedPublic

Description

Currently, mediawiki.widgets is one module that loads every widget that exist in MediaWiki. That makes it easy to use Widgets (simply by loading mediawiki.widgets), but it is (or can be, in future) a real performance problem. If you only want, as an example, to use the UserInputWidget, you still need to load mediawiki.widgets, which loads all other widgets, too (currently 33,4KB compressed), while 90% of the code isn't needed. That is, maybe, not a big problem now (33,4KB sounds very tiny compared with other modules), but if we create more and more wiget that will be a problem sometimes. And 33,4KB more or less on mobile (if we want to have widgets in mobile, too, which I assume, the module has the mobile target) is a big deal, if you don't need 30KB of it.

This task should be for dicsussions and a solution how we want to handle that. Maybe it's a good idea to have one module for each widget or another better separation (some widgets in one module), but all widgets in one module doesn't seem to be the right solution from my point of view.

Related Objects

Event Timeline

Florian created this task.Aug 11 2015, 8:24 PM
Florian raised the priority of this task from to Needs Triage.
Florian updated the task description. (Show Details)
Florian added subscribers: Florian, Jdforrester-WMF, matmarex.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 11 2015, 8:24 PM
Legoktm set Security to None.
Legoktm added a subscriber: Legoktm.
ori added a subscriber: Krinkle.

Also, the code in mediawiki.page.ready.js will load the "mediawiki.widgets" module if an infused element is on the page, regardless of what type of widget it is.

Change 241952 had a related patch set uploaded (by Legoktm):
Split DateInputWidget & CalendarWidget into a separate ResourceLoader module

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

I submitted a patch for DateInputWidget and CalendarWidget, which AFAIS brings in the biggest dependency with momentjs. If that one goes well, I'll submit more patches to split up the rest.

Change 241952 merged by jenkins-bot:
Split DateInputWidget & CalendarWidget into a separate ResourceLoader module

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

Change 242386 had a related patch set uploaded (by Jforrester):
Split DateInputWidget & CalendarWidget into a separate ResourceLoader module

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

Change 242386 merged by jenkins-bot:
Split DateInputWidget & CalendarWidget into a separate ResourceLoader module

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

Change 243701 had a related patch set uploaded (by Florianschmidtwelzow):
Split CategorySelector widget to it's own module

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

Change 243702 had a related patch set uploaded (by Florianschmidtwelzow):
Split out UserInputWidgets from mediawiki.widgets

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

Change 243713 had a related patch set uploaded (by Florianschmidtwelzow):
Use mediawiki.widgets.CategorySelector module for CategorySelector

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

Change 243701 merged by jenkins-bot:
mw.widgets: Split CategorySelector widget to its own module

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

Change 243713 merged by jenkins-bot:
Use mediawiki.widgets.CategorySelector module for CategorySelector

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

Change 243702 merged by jenkins-bot:
Split out UserInputWidgets from mediawiki.widgets

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

The CategorySelector (+UploadWizard dep) and UserInputWidgets changes need to be backported to REL1_26 still.

Legoktm claimed this task.Oct 28 2015, 6:13 PM
demon triaged this task as Normal priority.Nov 2 2015, 7:20 PM
demon moved this task from Backlog to To be backported on the MW-1.26-release board.
Isarra moved this task from Backlog to Bugs on the MediaWiki-Interface board.Nov 10 2015, 10:27 PM

Change 255139 had a related patch set uploaded (by Chad):
mw.widgets: Split CategorySelector widget to its own module

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

Change 255140 had a related patch set uploaded (by Chad):
Split out UserInputWidgets from mediawiki.widgets

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

Change 255142 had a related patch set uploaded (by Chad):
Use mediawiki.widgets.CategorySelector module for CategorySelector

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

demon added a subscriber: demon.Nov 24 2015, 5:32 PM

The three changes above are the backports to REL1_26.

Change 255139 merged by jenkins-bot:
mw.widgets: Split CategorySelector widget to its own module

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

Change 255140 merged by jenkins-bot:
Split out UserInputWidgets from mediawiki.widgets

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

demon moved this task from To be backported to Done on the MW-1.26-release board.Nov 24 2015, 5:52 PM

Change 255142 merged by jenkins-bot:
Use mediawiki.widgets.CategorySelector module for CategorySelector

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

demon closed this task as Resolved.Nov 24 2015, 5:57 PM

Backported to REL1_26.