Skip to content

Commit

Permalink
Remove this now no longer needed
Browse files Browse the repository at this point in the history
  • Loading branch information
zakstucke committed Nov 30, 2024
1 parent 9e6ea05 commit e599285
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions reactive_graph/src/computed/async_derived/arc_async_derived.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,6 @@ macro_rules! spawn_derived {
let inner = Arc::downgrade(&this.inner);
let wakers = Arc::downgrade(&this.wakers);
let loading = Arc::downgrade(&this.loading);
#[cfg(debug_assertions)]
let defined_at = this.defined_at;
let fut = async move {
while rx.next().await.is_some() {
let update_if_necessary = if $should_track {
Expand All @@ -325,21 +323,12 @@ macro_rules! spawn_derived {
if update_if_necessary || first_run.is_some() {
match (value.upgrade(), inner.upgrade(), wakers.upgrade(), loading.upgrade()) {
(Some(value), Some(inner), Some(wakers), Some(loading)) => {
let this = ArcAsyncDerived {
#[cfg(debug_assertions)]
defined_at,
value,
wakers,
inner,
loading,
};

let owner = this.inner.read().or_poisoned().owner.clone();
let owner = inner.read().or_poisoned().owner.clone();

this.loading.store(true, Ordering::Relaxed);
loading.store(true, Ordering::Relaxed);

if first_run.is_none() {
for sub in (&this.inner.read().or_poisoned().subscribers).into_iter() {
for sub in (&inner.read().or_poisoned().subscribers).into_iter() {
sub.mark_dirty();
}
}
Expand Down Expand Up @@ -372,7 +361,7 @@ macro_rules! spawn_derived {
});

let (this_version, suspense_ids) = {
let mut guard = this.inner.write().or_poisoned();
let mut guard = inner.write().or_poisoned();
guard.version += 1;
let version = guard.version;
let suspense_ids = mem::take(&mut guard.suspenses)
Expand All @@ -386,10 +375,10 @@ macro_rules! spawn_derived {

drop(suspense_ids);

let latest_version = this.inner.read().or_poisoned().version;
let latest_version = inner.read().or_poisoned().version;

if latest_version == this_version {
Self::set_inner_value(new_value, this.value, this.wakers, this.inner, this.loading, Some(ready_tx)).await;
Self::set_inner_value(new_value, value, wakers, inner, loading, Some(ready_tx)).await;
}
}
_ => break,
Expand Down

0 comments on commit e599285

Please sign in to comment.