Skip to content

Commit

Permalink
ObservableCursor: _.clone collection lists before passing them to cal…
Browse files Browse the repository at this point in the history
…lbacks

Fixes Urigo#244
  • Loading branch information
Dominique Quatravaux committed Nov 18, 2019
1 parent 8f41c38 commit afa9f36
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/ObservableCursor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ export class ObservableCursor<T> extends Observable<T[]> {

Meteor.setTimeout(() => {
if (this._isDataInitinialized) {
observer.next(this._data);
observer.next(_.clone(this._data));
} else if (cursor.count() === 0) {
this._isDataInitinialized = true;
observer.next(this._data);
observer.next(_.clone(this._data));
}
}, 0);

Expand Down Expand Up @@ -144,7 +144,7 @@ export class ObservableCursor<T> extends Observable<T[]> {
this._countObserver.next(this._data.length);

this._observers.forEach(observer => {
observer.next(data);
observer.next(_.clone(data));
});
}

Expand Down Expand Up @@ -173,7 +173,7 @@ export class ObservableCursor<T> extends Observable<T[]> {
this._isDataInitinialized = true;

this._zone.run(() => {
this._runNext(this._data);
this._runNext(this._data);
});
}

Expand Down

0 comments on commit afa9f36

Please sign in to comment.