Page MenuHomePhabricator

Avoid wgVisualEditorToolbarScrollOffset data export on page views
Closed, ResolvedPublic

Description

In the HTML:

"wgVisualEditorToolbarScrollOffset": 0,

Source code: VisualEditorHooks.php#69.
Internal consumer: ve.init.mw.ArticleTarget.js#45.

Seems to be for internal-use only, which means we could optimise the HTML payload a little bit by transferring this privately via the VE file module request, rather than the HTML request.

Looking further, it seems the value is usually 0, which could also be optimised away as a default for the code that reads the key.

Recommendation:

  • Only export the data key when the value is not 0.
  • Move the logic for generating the data key from the HTML hook to the JS module (using RL's packageFiles feature).

Outcome:

  • Slightly reduced head-HTML footprint, which means pages can start a tiny bit sooner.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change 501661 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/extensions/VisualEditor@master] Hooks: Don't set wgVisualEditorToolbarScrollOffset in RL when 0

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

Change 501661 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Hooks: Don't set wgVisualEditorToolbarScrollOffset in RL when 0

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

ppelberg claimed this task.