Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Internal: Ensure that commit is executed in a single view change batch.
Browse files Browse the repository at this point in the history
  • Loading branch information
mlewand committed Apr 21, 2020
1 parent 3f105c7 commit 32e18a4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/widgetresize/resizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,11 @@ export default class Resizer {
const unit = this._options.unit || '%';
const newValue = ( unit === '%' ? this.state.proposedWidthPercents : this.state.proposedWidth ) + unit;

this._cleanup();
this._options.onCommit( newValue );
// Both cleanup and onCommit callback are very likely to make view changes. Ensure that it is made in a single step.
this._options.editor.editing.view.change( () => {
this._cleanup();
this._options.onCommit( newValue );
} );
}

/**
Expand Down

0 comments on commit 32e18a4

Please sign in to comment.