fix: use arcwake instead of rcwake

This commit is contained in:
Jonathan Kelley committed 2022-12-20 11:13:06 -08:00
1 parent 651ab3e7e3
commit 2fa3fe1fc0
16 files changed
+326 -79

No files matched your search

+11 -5
View File
@@ -1,10 +1,10 @@
use crate::{
any_props::AnyProps,
bump_frame::BumpFrame,
innerlude::DirtyScope,
innerlude::{DirtyScope, VPlaceholder},
innerlude::{SuspenseId, SuspenseLeaf},
nodes::RenderReturn,
scheduler::RcWake,
scheduler::ArcWake,
scopes::{ScopeId, ScopeState},
virtual_dom::VirtualDom,
};
@@ -14,6 +14,7 @@ use std::{
mem,
pin::Pin,
rc::Rc,
sync::Arc,
task::{Context, Poll},
};
@@ -79,6 +80,7 @@ impl VirtualDom {
// safety: due to how we traverse the tree, we know that the scope is not currently aliased
let props: &dyn AnyProps = scope.props.as_ref().unwrap().as_ref();
let props: &dyn AnyProps = mem::transmute(props);
props.render(scope).extend_lifetime()
};
@@ -89,7 +91,7 @@ impl VirtualDom {
let entry = leaves.vacant_entry();
let suspense_id = SuspenseId(entry.key());
let leaf = Rc::new(SuspenseLeaf {
let leaf = Arc::new(SuspenseLeaf {
scope_id,
task: task.as_mut(),
id: suspense_id,
@@ -108,7 +110,11 @@ impl VirtualDom {
match pinned.poll_unpin(&mut cx) {
// If nodes are produced, then set it and we can break
Poll::Ready(nodes) => {
new_nodes = RenderReturn::Sync(nodes);
new_nodes = match nodes {
Some(nodes) => RenderReturn::Ready(nodes),
None => RenderReturn::default(),
};
break;
}
@@ -150,6 +156,6 @@ impl VirtualDom {
});
// rebind the lifetime now that its stored internally
unsafe { mem::transmute(allocated) }
unsafe { allocated.extend_lifetime_ref() }
}
}