Imagine we have foo$ and bar$ and both of them are BehaviorSubjects.
I have a bug in angular that sometimes in some cases foo$.subscribe(bar$)
works fine, in most casses actually.
But sometimes I have a bug and its not working until I do foo$.subscribe(foo => bar$.next(foo))
, and even worse it seems like it works the first time and then the second time it dose not work.
I experienced this bug sometimes but still rearly. Not sure even how to make a proper minimal reproduction. I would like to understand what makes this causing the bug? And is the angular team aware of it? I didn't see anywhere so far anyone posting about it.
Have checked if it solves anything by removing zonejs and it dose not.
Imagine we have foo$ and bar$ and both of them are BehaviorSubjects.
I have a bug in angular that sometimes in some cases foo$.subscribe(bar$)
works fine, in most casses actually.
But sometimes I have a bug and its not working until I do foo$.subscribe(foo => bar$.next(foo))
, and even worse it seems like it works the first time and then the second time it dose not work.
I experienced this bug sometimes but still rearly. Not sure even how to make a proper minimal reproduction. I would like to understand what makes this causing the bug? And is the angular team aware of it? I didn't see anywhere so far anyone posting about it.
Have checked if it solves anything by removing zonejs and it dose not.
Share Improve this question asked Mar 20 at 12:34 Muhamed KarajicMuhamed Karajic 811 silver badge7 bronze badges 4 |1 Answer
Reset to default 2When you do this.foo$.pipe(takeUntil(this.onDestroy$)).subscribe(this.bar$);
The bar$
subject actually completes when the foo$
subscription completes (because if the takeUntil
).
This is become subscribe(this.bar$)
implies
foo$.subscribe({
next: value => bar$.next(value),
error: error => bar$.error(error),
complete: () => bar$plete(),
})
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744409290a4572794.html
this.onDestroy$.next();
call. but still strange that it works fine when changing the line of code. – Muhamed Karajic Commented Mar 20 at 13:12