Urigo / meteor-rxjs

Exposing Mongo Cursor as RxJS Observable

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Collection.find().zone() not updating zone when server is making changes in collection

ansaries opened this issue · comments

Not Working code:

// things: Observable<THING[]> // type of things is array of THING in class definition.
// in template <div *ngFor="let thing of things | async">
           
MeteorObservable.autorun().zone().subscribe(() => {
         this.things = Things
          .find({ someIdOfSubDocument: changedProp.currentValue._id })
           .zone();
           });
});           

Only possible solution I found is below:


//things: THING[]; // type of things is array of THING in class definition.
// in template <div *ngFor="let thing of things">
 MeteorObservable.autorun().zone().subscribe(() => {
      Things
         .find({ someIdOfSubDocument: changedProp.currentValue._id })
          .zone()
          .subscribe((quotes) => {
              this.ngZone.run(() => {
                  this.things = quotes;
                });
            });
});              

Why the things: Observable<THING[]> is not updating the view upon changes from the server, however, it is updating only on the new records.