You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, i would like to ask for a solution to fairly common problem tied to withObservables.
official documentation states this:
Reactive optional relations
Continuing the above example, if the comment has no author, the comment.author_id must be null. If comment.author_id has a value, the author record it refers to must be stored in the database, otherwise withObservables will throw an error that the record was not found.
My issue is, that i would like to handle case, when i have relation on model and i want observe it in withObservables.
But what if relatedModel does not exist? Or what if even myModel does not exist.
i tried simple myModel?.relatedModel || of(null) which should also be the result i am looking for pretty much (or even better would be "simple" null)
I am fairly unfamiliar with Rxjs, but i tried to solve this in quite a few different ways, but none was successful.
I always end up with error relatedModel#1 not found which means complete crash of app.
Tried using defer, map, switchMap, pipe, nothing was working for me. Is there any way to handle this?
I know i can solve this by using query(), but i believe there should be more elegant solution for this which i struggle to find.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello, i would like to ask for a solution to fairly common problem tied to withObservables.
official documentation states this:
My issue is, that i would like to handle case, when i have relation on model and i want observe it in withObservables.
But what if relatedModel does not exist? Or what if even myModel does not exist.
i tried simple
myModel?.relatedModel || of(null)
which should also be the result i am looking for pretty much (or even better would be "simple" null)I am fairly unfamiliar with Rxjs, but i tried to solve this in quite a few different ways, but none was successful.
I always end up with error relatedModel#1 not found which means complete crash of app.
Tried using defer, map, switchMap, pipe, nothing was working for me. Is there any way to handle this?
I know i can solve this by using query(), but i believe there should be more elegant solution for this which i struggle to find.
Beta Was this translation helpful? Give feedback.
All reactions