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.
Description
Related Objects
Event Timeline
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?
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.