-
-
Notifications
You must be signed in to change notification settings - Fork 575
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
translate.get(...).flatMap(...) not working in pending state #308
Comments
I can confirm this seems like a bug. Have to dive deeper to find the cause. |
I submitted a PR to fix this issue. I used |
Ok, I found the root issue. |
There's a good reason for adding the share, otherwise it will request multiple times the json file from the server (or anything else that a custom loader can do) if you have multiple translations on your page. Imagine a page with 10 translated words, then it would make 10 http requests. |
But even if I don't think |
Okay. I found the root root root issue! It's a bug in RxJS (ReactiveX/rxjs#2145) that affects hot observables. I've added a PR that fixes this bug without removing the |
There's a bug in RxJS that breaks hot observables if one subscriber ignores errors (see ReactiveX/rxjs#2145 ), which is causing #308. This patch fixes it by always handling observable errors (handling errors is a good idea anyway). Fixes #308
Thanks a lot for taking the time to find another solution and submitting a PR, I've merged it! |
I'm submitting a ... (check one with "x")
Not sure if it's a bug or misuse by me...
Current behavior
Using
translate.get('...').flatMap(...).subscribe(observer)
does not work ifthis.pending
is set.Expected/desired behavior
The
observer
gets called with the translation.Reproduction of the problem
Made a small plunker. Calling
doIt()
fromngOnInit()
does not work, calling it afterwards works just fine. Although I didn't dig too deep it looks like to be caused bythis.pending
.The text was updated successfully, but these errors were encountered: