chore: remove unused cancellation logic for now

This commit is contained in:
Greg Johnston 2024-09-09 21:19:55 -04:00
parent 7c0889e873
commit 346efd66f5

View file

@ -9,7 +9,7 @@ use crate::{
}, },
}; };
use any_spawner::Executor; use any_spawner::Executor;
use futures::{channel::oneshot, select, FutureExt}; use futures::{select, FutureExt};
use or_poisoned::OrPoisoned; use or_poisoned::OrPoisoned;
use reactive_graph::{ use reactive_graph::{
computed::{ computed::{
@ -48,17 +48,15 @@ pub(crate) struct SuspendSubscriber {
struct SuspendSubscriberInner { struct SuspendSubscriberInner {
outer_subscriber: Option<AnySubscriber>, outer_subscriber: Option<AnySubscriber>,
sources: Mutex<Vec<AnySource>>, sources: Mutex<Vec<AnySource>>,
cancel: Mutex<Option<oneshot::Sender<()>>>,
} }
impl SuspendSubscriber { impl SuspendSubscriber {
pub fn new(cancel: oneshot::Sender<()>) -> Self { pub fn new() -> Self {
let outer_subscriber = Observer::get(); let outer_subscriber = Observer::get();
Self { Self {
inner: Arc::new(SuspendSubscriberInner { inner: Arc::new(SuspendSubscriberInner {
outer_subscriber, outer_subscriber,
sources: Default::default(), sources: Default::default(),
cancel: Mutex::new(Some(cancel)),
}), }),
} }
} }
@ -81,11 +79,7 @@ impl SuspendSubscriber {
} }
impl ReactiveNode for SuspendSubscriberInner { impl ReactiveNode for SuspendSubscriberInner {
fn mark_dirty(&self) { fn mark_dirty(&self) {}
if let Some(tx) = self.cancel.lock().or_poisoned().take() {
_ = tx.send(());
}
}
fn mark_check(&self) {} fn mark_check(&self) {}
@ -120,8 +114,7 @@ impl ToAnySubscriber for SuspendSubscriber {
impl<Fut> Suspend<Fut> { impl<Fut> Suspend<Fut> {
/// Creates a new suspended view. /// Creates a new suspended view.
pub fn new(fut: Fut) -> Self { pub fn new(fut: Fut) -> Self {
let (tx, rx) = oneshot::channel(); let subscriber = SuspendSubscriber::new();
let subscriber = SuspendSubscriber::new(tx);
let any_subscriber = subscriber.to_any_subscriber(); let any_subscriber = subscriber.to_any_subscriber();
let inner = let inner =
any_subscriber.with_observer(|| Box::pin(ScopedFuture::new(fut))); any_subscriber.with_observer(|| Box::pin(ScopedFuture::new(fut)));