Page MenuHomePhabricator

Inserting template makes 2x the same API parser calls
Closed, ResolvedPublic1 Estimated Story Points

Description

  1. https://www.mediawiki.org/wiki/Project:Sandbox?action=edit
  2. Insert Template
  3. Name "Phpi"
  4. Content parameter "$foo = foo();"
  5. Insert

Observed Network requests (XHR):

  1. Via ve.dm.MWTransclusionModel.insertTransclusionNode originating from OO.ui.ProcessDialog.executeAction from OO.ui.Dialog.onActionClick
# Request
POST https://www.mediawiki.org/w/api.php
Request Data
action:visualeditor
format:json
paction:parsefragment
page:Project:Sandbox
wikitext:{{Phpi|1=$foo = foo();}}
pst:1

# Response
content-length:290
content-type:application/json; charset=utf-8
date:Mon, 30 Jan 2017 23:40:43 GMT
server:mw1234.eqiad.wmnet

{"visualeditor":{"result":"success","content":"<p id=\"mwAQ\"> ...
`
  1. Via ve.ce.MWTransclusionNode.generateContents, ve.ce.GeneratedContentNode.forceUpdate, originating from ve.dm.SurfaceFragment.insertContent.
# Request
POST https://www.mediawiki.org/w/api.php
Form Data
action:visualeditor
format:json
paction:parsefragment
page:Project:Sandbox
wikitext:{{Phpi|1=$foo = foo();}}
pst:1

# Response
content-length:290
content-type:application/json; charset=utf-8
date:Mon, 30 Jan 2017 23:40:43 GMT
server:mw1199.eqiad.wmnet

{"visualeditor":{"result":"success","content":"<p id=\"mwAQ\"> ...

Event Timeline

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

The first one is to determine if the template is going to be inline or block by looking at the generated HTML. We should really stick that result in the cache.

Change 336494 had a related patch set uploaded (by Esanders):
Cache generated content request when inserting templates

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

Jdforrester-WMF triaged this task as Medium priority.
Jdforrester-WMF moved this task from To Triage to TR1: Releases on the VisualEditor board.
Jdforrester-WMF set the point value for this task to 1.

Change 336494 merged by jenkins-bot:
Cache generated content request when inserting templates

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