Skip to content

Commit

Permalink
rm unnecessary if check
Browse files Browse the repository at this point in the history
  • Loading branch information
jinyus committed Jan 27, 2024
1 parent 6d14020 commit ddbbcc0
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class DerivedFutureBeacon<T> extends FutureBeacon<T>
}

_listeners.whenEmpty(() {
// setting status to idle will dispose the internal effect
// and stop listening to dependencies
_status.set(DerivedFutureStatus.idle);
_sleeping = true;
});
Expand All @@ -40,7 +42,7 @@ class DerivedFutureBeacon<T> extends FutureBeacon<T>

@override
AsyncValue<T> get value {
if (_sleeping && _status.peek() == DerivedFutureStatus.idle) {
if (_sleeping) {
start();
_sleeping = false;
}
Expand All @@ -49,7 +51,7 @@ class DerivedFutureBeacon<T> extends FutureBeacon<T>

@override
AsyncValue<T> peek() {
if (_sleeping && _status.peek() == DerivedFutureStatus.idle) {
if (_sleeping) {
start();
_sleeping = false;
}
Expand Down

0 comments on commit ddbbcc0

Please sign in to comment.