core
core copied to clipboard
fix(pipe): isObservable usage
isObservable(res) instead of isObservable(res.subscribe)
I changed the usage of isObservable function to the correct one. Previously, it checks the subscribe function itself while it should check the observable itself. I also add a test that describes in which case it could lead to problem.
Without my fix the test is red and the actual result is
"{"operator": [Function anonymous], "source": {"_subscribe": [Function anonymous]}}"

With my fix the test is green.

In my test I described the scenario of a race condition when there is a bit delay of loading new language translation (after switching) and the usage MissingHandler with observable takes place.
P.S.
In many cases the next tick will solve the problem and user will see the correct translation, but there is a chance to see the stringified observable "{"operator": [Function anonymous], "source": {"_subscribe": [Function anonymous]}}"
In my PR I also removed some redundat imports.