Page MenuHomePhabricator

Minimize the times OtherKeys component calls wikilambda_fetch; create a global state manager?
Closed, ResolvedPublic

Description

OtherKeys fetches information about the labels that contains, either when the ZObject is visualized, or when a new ZObject is being created and new keys are being added.

Currently, on mounting OtherKeys, we do a call to wikilambda_fetch for each key found in this.keyTypes, which sometimes means that it makes this api call for fetching the information of the same ID more than once.

Some improvements on different levels can be:

  • The api admits a list of keys, so instead of doing a call in each loop iteration, we can collect those keys and request them together (e.g. Z1|Z2|Z3)
  • When seeking the information of a given list of keys, fetch this on a global state handler (Vuex) and let the global state figure out whether the information is available or it needs to be fetched from the api.

Also notice that:

  • Currently the labels fetches things that are already present on editingData.zkeylabels with the information of ZTypeRegistry::TEMP_KEY_LABELS_IN_ENGLISH
  • We should stop sending all this data at the beginning and limit ourselves to request to the API whatever necessary.

Event Timeline

Jdforrester-WMF renamed this task from Minimize the times OtherKeys component calls wikilambda_fetch to Minimize the times OtherKeys component calls wikilambda_fetch; create a global state manager?.Dec 16 2020, 6:15 PM

Change 651229 had a related patch set uploaded (by Genoveva Galarza; owner: Genoveva Galarza):
[mediawiki/extensions/WikiLambda@master] Add vuex to project and create base store structure.

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

Change 651230 had a related patch set uploaded (by Genoveva Galarza; owner: Genoveva Galarza):
[mediawiki/extensions/WikiLambda@master] Save zid info and labels in the store

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

Change 651229 merged by jenkins-bot:
[mediawiki/extensions/WikiLambda@master] Add vuex to project and create base store structure.

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

Change 651230 merged by jenkins-bot:
[mediawiki/extensions/WikiLambda@master] Save zid info and labels in the store

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

@gengh this is great, thanks! I was hoping we'd get vuex pieces some time, definitely needed. I'm a little stalled right now on what I was working on because I need to convert a zid to a label (also a very general problem, but this is needed to remove TypeSelector.vue and the dependency on the hardcoded type list); ok if I look at adding that to your key label support?