Page MenuHomePhabricator

[WBClient] Mitigate size of included resource module `mw.config.values.wbSiteDetails` in Wikibase Client sites
Closed, ResolvedPublic5 Estimated Story Points

Description

In T331760: "mw.config.values.wbSiteDetails" module downloads 27.3 kB of compressed JavaScript on Vector-22 page load it was identified that Wikibase causes a large ResourceLoader module to be loaded on initial page render. To improve overall performance and SEO on Wikibase Client instances that utilize Vector 2022, it was decided that this payload should be reduced by potentially creating a separate resource module to load sites information for only the local Wikibase Client site (as opposed to all of them, see: T331760#8761970).

Acceptance Criteria:

  • Vector 2022 on Wikibase Client wikis only loads site information for the current local site

Details

Related Changes in Gerrit:

Event Timeline

Prio Notes (from parent task):

  • Affects end users / production
  • Does not affect development efforts
  • Does not affect onboarding
  • Affects additional stakeholders (WMF web team)

Adding a separate RL module for just the local site brings some cost with it, but if it lets us mostly skip loading the much heavier module of all sites’ information, it could still be worth it. (Alternatively, if we think this information is needed frequently enough, we could perhaps add it to the parser output of all pages, without needing to load a RL module at all.)

“[Adding] it to the parser output of all pages” is actually what @Michael first did in patch sets 1–3 of Link to the Site subgroup in the language selector (I’d forgotten in the meantime but now looked through the review comments again); one concern was that the new variable wouldn’t be available in old / cached parser output for a while. If we decide to add it to the parser output again, I suppose we can make the JS code check for the config variable first, and fall back to loading mw.config.values.wbSiteDetails after all if the config variable doesn’t exist yet. But I’d also argued at the time that “it feels strange to me to add using addJsConfigVars(), when most of the config variables we add that way are more or less specific to the current page view, and page-independent data like wbRepo added via ResourceLoader modules instead”, so maybe a new ResourceLoader module is better after all. (mw.config.values.wbCurrentSiteDetails? 🚲🏠)

Task Breakdown Notes

  • This occurs only in Vector 2022
  • A new resource loader module is needed

Potential Plan of Action

Change 911841 had a related patch set uploaded (by Guergana Tzatchkova; author: Guergana Tzatchkova):

[mediawiki/extensions/Wikibase@master] [WiP] Create new CurrentSiteModule

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

Change 911841 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Create new CurrentSiteModule

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

\o/ Nice! Deployed to enwiki and only weighs 2.82kb gzipped

image.png (141×544 px, 21 KB)

Thank you!