-
Notifications
You must be signed in to change notification settings - Fork 622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Different subscription behaviour for mongo collections #1939
Comments
Try to use this way; ngOnInit(){
this.episodesSubscription = MeteorObservable.subscribe('episodes').subscribe(() => {
this.episodes$ = Episodes.find();
})
}
ngOnDestroy(){
if(this.episodesSubscription){
this.episodesSubscription.unsubscribe();
}
} |
I moved my subscription to a service, since I want a singleton watching the episode change and then call the redux action, which is using an @effect that calls the
|
Maybe you should try |
hmm, it doesn't help that I don't entirely know what I am doing.
Adding a |
@ardatan can I ask you something off topic: Do you think Angular, Meteor and NGRX is a bit of overkill? I though NGRX was the way to go, but I hear a lot of people in the react world mention graphql instead of redux. |
If was playing with my subscription of a mongo collection, doing search on a third party api that resulted in inserting records in my mongo collection. However, I noticed that I didn't see my subscription working in my template when I trigger the mongo insert while using one method, but it did work with another method.
Again for me this is confusing, what is the best practice and/or is this behaviour on purpose?
This subscription auto updates when I add new records manually or trigger the api that inserts mongo records:
This option looks a bit weird, since you setup a subscription, but we don't use a subject (rxjs) and then we just seem to bind Episodes.find(), which is a rxjs mongo observable collection at this time, to the
episodes$
observable.The second method:
This subscription DOESN'T auto update, only loads one time on page load:
I ran into the second method in one of the examples and it looked elegant, but it has some different behaviour than the first method.
I would have expected this to work since the RxJS Mongo observable collection that was setup. However it doesn't autorun, or detect changes in my situation.
Should I also use the second method for setting up a subscription?
I hope my questions aren't annoying, I am re-exploring Meteor after 2 years of absence (just pure angular 4 during that time) and I really want it to work with Angular 6.
***Update: at one point I thought it had something to do with
ChangeDetectionStrategy.OnPush
but it didn't matter turning that off.The text was updated successfully, but these errors were encountered: