Page MenuHomePhabricator

Migrate uses of codex-search in Vector to use CodexModule
Closed, ResolvedPublic2 Estimated Story Points

Description

Following T353844, stop using @wikimedia/codex-search and codex-search-styles, instead use the new skins.vector.search.codex.styles module.

This will increase CSS bytes by a modest 1.2kb

TODO

  • Create a new module skins.vector.search.codex.scripts that can replace @wikimedia/codex-search
  • Replace codex-search-styles with the existing skins.vector.search.codex.styles
  • Disable the interface-message-box feature in the skins.vector.styles definition - these styles are now provided by Codex.

Checklist

  • Make sure skins.vector.search.codex.scripts only requires CdxTypeaheadSearch component and codexScriptOnly is set to true:
"skins.vector.search.codex.scripts": {
	"class": "MediaWiki\\ResourceLoader\\CodexModule",
	"codexScriptOnly": true,
	"codexComponents": [
		"CdxTypeaheadSearch"
	]
}
  • Make sure skins.vector.search.codex.scripts module is loaded and available to use. mw.loader.load/mw.loader.using or skin.json required module
  • Update skins.vector.search/App.vue { CdxTypeaheadSearch } = require( '@wikimedia/codex-search' ) should be updated to use skins.vector.search.codex.scripts
{ CdxTypeaheadSearch } = require( 'skins.vector.search.codex.scripts' )

Event Timeline

Hi @Catrope - one implication of this change is going to be that we load codex-search-styles and the new skins.vector.search.codex.styles together as several extensions load codex-search-styles on payload - these are MultimediaViewer, Popups, UniversalLanguageSelector, MobileFrontend [1]. I assume gzip will take care of any additional bytes loaded if we load them both? We may need assistance from DST during this task.

Also do we have open tickets for fixing the other usages?

[1] https://codesearch.wmcloud.org/search/?q=codex-search-styles&files=&excludeFiles=&repos=

There are open tasks for migrating all of those, see T356675. If there's an intermediate state while some things are migrated but others aren't, then as you say both modules will be loaded together. Hopefully gzip will handle that reasonably well, but even if not, I think the short-term hit is fine as long as this intermediate state doesn't last too long.

I should also add: CodexModule doesn't currently deduplicate styles, that's T350056 (which is stalled currently). Some duplication may occur between Vector and other extensions, but we think that is outweighed by the fact that each extension will load only what it needs and no more; the fact that the duplicated components are likely to be small; and that most of those only load on certain pages or in certain circumstances. We're hoping to eventually solve the duplication problem, either through T350056 or another approach. If there's a situation where components are duplicated on every page, let us know and we'll see what we can do about it (it may change our attitude towards T350056 for example).

Jdlrobson set the point value for this task to 2.
Jdlrobson added a subscriber: Mabualruz.

Note you also don't have to put this in a separate module -- if there's only one module that uses TypeaheadSearch, you can put all the CodexModule stuff in that module itself, and then do const { CdxTypeaheadSearch } = require( './codex.js' );

Note you also don't have to put this in a separate module -- if there's only one module that uses TypeaheadSearch, you can put all the CodexModule stuff in that module itself, and then do const { CdxTypeaheadSearch } = require( './codex.js' );

It is the only component needed in JS. I think for now this is sufficient, unless it brings a dependency issue

Change 1010258 had a related patch set uploaded (by Mabualruz; author: Mabualruz):

[mediawiki/skins/Vector@master] Migrate uses of codex-search in Vector to use CodexModule

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

Change 1010258 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Migrate uses of codex-search in Vector to use CodexModule

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

Edtadros subscribed.

@Jdlrobson this either needs test steps or isn't testable, please advise.

We can use pixel to QA this one. I can sign off. Thanks Edward!

Jdlrobson claimed this task.
Jdlrobson added a subscriber: ovasileva.