Closed rikutiira closed 6 years ago
Hmm... I think that works as expected. From Kefir's docs on toPromise
:
The promise will be fulfilled or rejected at the moment source observable ends, with the latest value or error.
Atoms usually do not end.
Would U.atom('foo').take(1).toPromise()
work in your use case?
Yeah, you are right, I remembered that it would take the current value of observable. Should have checked Kefir docs for clarity, sorry!
Seems like there's some issue with Kefir's
.toPromise()
when working with atoms, as the returned promise is alwayspending
.U.atom('foo').toPromise() // pending
U.atom('foo').toProperty().toPromise() // pending
U.atom('foo').toProperty(() => 'bar').toPromise() // pending