Closed arosendorff closed 5 years ago
@arosendorff how about this?
import { first } from 'rxjs/operators'
const isNoProblem = await obj.isNoProblem.pipe(first()).toPromise()
@rkrajewski Fantastic, that works perfectly! I'm still a bit novice with RXJS, but it's pretty powerful! Does this emit a value when you call it because any WatermelonDB source is a BehaviorSubject?
Does this emit a value when you call it because any WatermelonDB source is a BehaviorSubject?
This should work for any kind of Observable, but it may await for emitted value, if it hasn't been emitted yet, and BehaviorSubject has always its initial value. Besides it's not true, that any WatermelonDB source is a BehaviorSubject.
Say I have a custom observable field like so:
I know that
withObservables()
will correctly observe and return my custom field, but is there a way to directly return the current value of this custom observable, i.e. like how you can call.fetch()
on a regular query to get its response?