This repository has been archived by the owner on Aug 25, 2021. It is now read-only.
ObservableField::when condition check before Future poll in 'medea-reactive' crate #163
Labels
bug
Something isn't working
enhancement
Improvement of existing features or bugfix
k::api
Related to API (application interface)
k::refactor
Refactoring, technical debt elimination and other improvements of existing code base
Revealed from #159
Caused by #81
Summary
ObservableField::when
andObservableFild::when_eq
instantly returnsfuture::ok
if provided condition already matches current value. But user expects that this computation will be performed onFuture
poll. This can cause bugs if someone will decide to poll receivedFuture
later.Steps to reproduce
What is the current bug behavior?
when_fut
Future
will be resolved.What is the expected correct behavior?
when_fut
Future
shouldn't be resolved becauseval
's current value is no longer0
whenwhen_fut
Future
polled.Possible fixes
Use
Rc<RefCell<T>>
as value storage inObservableField
, move clonedRc
to the returnedFuture
and do this check in thisFuture
.The text was updated successfully, but these errors were encountered: