Page MenuHomePhabricator

ve.init.mw.ViewPageTarget.prototype.setupToolbar called twice
Closed, ResolvedPublic

Description

This could be deliberate, but it looks silly: ve.init.mw.ViewPageTarget.prototype.setupToolbar gets called twice during VE initialization. The if ( !wasSetup ) guard ensures that the CSS transition is only applied once, but it does not prevent the a duplicate toolbarSetupDeferred done handler from being registered.

Event Timeline

ori assigned this task to Krinkle.
ori raised the priority of this task from to Needs Triage.
ori updated the task description. (Show Details)
ori added a project: VisualEditor-Performance.
ori subscribed.
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

This is probably related to the dummy toolbar we have. Before the document is requested, parsed and converted, we create a dummy toolbar that is later replaced. I took care not to re-create a transition or promise, but instead register onto the existing promise if there is one.

rEVED703b2c2ed08e: Show the toolbar as soon as the target has been activated
https://github.com/wikimedia/mediawiki-extensions-VisualEditor/commit/703b2c2ed08e13afd856fbb72b44673863cc135f

It depends on how the state is handled, but perhaps we should somehow cancel the callback if the second one gets there before it runs. Or perhaps the dummy one doesn't/shouldn't have that additional code at all?

Jdforrester-WMF moved this task from To Triage to Bug Fixes on the VisualEditor board.
Jdforrester-WMF set Security to None.

Hmm, I may have accidentally fixed a part of this in https://gerrit.wikimedia.org/r/195046 and https://gerrit.wikimedia.org/r/195048, or possibly broken something if this was actually intentional. I saw no problematic behavior with these patches, though.