Skip to content

Commit a12479e

Browse files
committed
fix: multiple updates in node
1 parent 076d913 commit a12479e

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

core/Node.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ Node.prototype.getLocation = function getLocation () {
201201
Node.prototype.getId = Node.prototype.getLocation;
202202

203203
/**
204-
* Globally dispatches the event using the Dispatch. All descendent nodes will
204+
* Dispatches the event using the Dispatch. All descendent nodes will
205205
* receive the dispatched event.
206206
*
207207
* @method emit
@@ -370,8 +370,10 @@ Node.prototype.getParent = function getParent () {
370370
Node.prototype.requestUpdate = function requestUpdate (requester) {
371371
if (this._inUpdate || !this.isMounted())
372372
return this.requestUpdateOnNextTick(requester);
373-
this._updateQueue.push(requester);
374-
if (!this._requestingUpdate) this._requestUpdate();
373+
if (this._updateQueue.indexOf(requester) === -1) {
374+
this._updateQueue.push(requester);
375+
if (!this._requestingUpdate) this._requestUpdate();
376+
}
375377
return this;
376378
};
377379

@@ -390,7 +392,8 @@ Node.prototype.requestUpdate = function requestUpdate (requester) {
390392
* @return {Node} this
391393
*/
392394
Node.prototype.requestUpdateOnNextTick = function requestUpdateOnNextTick (requester) {
393-
this._nextUpdateQueue.push(requester);
395+
if (this._nextUpdateQueue.indexOf(requester) === -1)
396+
this._nextUpdateQueue.push(requester);
394397
return this;
395398
};
396399

@@ -1170,8 +1173,6 @@ Node.prototype.update = function update (time){
11701173
var queue = this._updateQueue;
11711174
var item;
11721175

1173-
if (this.onUpdate) this.onUpdate();
1174-
11751176
while (nextQueue.length) queue.unshift(nextQueue.pop());
11761177

11771178
while (queue.length) {

0 commit comments

Comments
 (0)