Page MenuHomePhabricator

FunctionDefinitionInputsItem: (Performance issue) Actions to set up the argument are triggered on every key press which means front-end performance issues
Closed, ResolvedPublicBUG REPORT

Description

Description

Cdx-text-input component inside FunctionDefinitionInputsItem triggers the action setArgumentLabel for every letter that's pressed. The way this action works means a lot of vuex store modifications. Because this is triggered for every character, typing a word becomes a very intense operation which massively affects front-end performance.

These are the actions triggered for one letter in the input:

Screenshot from 2023-01-05 14-36-10.png (985×1 px, 195 KB)

We should investigate into this, do a bit of profiling, see if we can reduce the load that the vuex store takes for updating these fields, and maybe only trigger these actions when the input changes and not when it receives each letter.

Steps to reproduce:

  1. Go to https://wikifunctions.beta.wmflabs.org/wiki/Special:CreateZObject?zid=Z8
  2. Write text in the input text fields
  3. Try adding another input and write text in the field

Observed behavior:

  • Response is delayed

Expected behavior (Acceptance criteria):

  • No performance issues

Completion checklist

Event Timeline

Example failure pattern:

  • Switch an input to a reference in JSON (expert) mode
  • Try to type "Z12345"
  • What should happen: A ZReference to Z12345 is created after you click away.
  • What actually happens: A ZReference to Z1 (ZObject) is created as soon as you type '1', then the '2345' input is lost as the focus changes.

Yes, i would believe so, would check to make sure I do not bring back that bug before creating a patch, thanks for linking this

Change 883563 had a related patch set uploaded (by AdesojiThisDot; author: AdesojiThisDot):

[mediawiki/extensions/WikiLambda@master] add debounce to function input

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

Change 883563 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] add debounce to function input

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

DVrandecic updated the task description. (Show Details)