jenkins-bot has submitted this change and it was merged.

Change subject: Optimise history stack truncation
......................................................................


Optimise history stack truncation

If undoIndex is 0 then we don't need to do anything, or even
emit the history event which is quite expensive as it triggers
various node redraws.

Bug: 52012
Change-Id: I09ca2d6cd0f4cbaf8316819dab0bd6edfc5de62c
---
M modules/ve/dm/ve.dm.Surface.js
1 file changed, 5 insertions(+), 3 deletions(-)

Approvals:
  Catrope: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/ve/dm/ve.dm.Surface.js b/modules/ve/dm/ve.dm.Surface.js
index 93606d2..3790c2b 100644
--- a/modules/ve/dm/ve.dm.Surface.js
+++ b/modules/ve/dm/ve.dm.Surface.js
@@ -273,9 +273,11 @@
  * @emits history
  */
 ve.dm.Surface.prototype.truncateUndoStack = function () {
-       this.bigStack = this.bigStack.slice( 0, this.bigStack.length - 
this.undoIndex );
-       this.undoIndex = 0;
-       this.emit( 'history' );
+       if ( this.undoIndex ) {
+               this.bigStack = this.bigStack.slice( 0, this.bigStack.length - 
this.undoIndex );
+               this.undoIndex = 0;
+               this.emit( 'history' );
+       }
 };
 
 /**

-- 
To view, visit https://gerrit.wikimedia.org/r/75863
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I09ca2d6cd0f4cbaf8316819dab0bd6edfc5de62c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to