From 464b457b80a40c0ff24386342a0e81ecfeac4723 Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Sun, 7 Nov 2021 01:07:42 -0500 Subject: [PATCH] wip: move more stuff out --- packages/core/src/lib.rs | 6 ------ packages/core/src/{ => old}/debug_dom.rs | 0 packages/core/src/{ => old}/hooks.rs | 0 packages/core/src/virtual_dom.rs | 19 +++---------------- 4 files changed, 3 insertions(+), 22 deletions(-) rename packages/core/src/{ => old}/debug_dom.rs (100%) rename packages/core/src/{ => old}/hooks.rs (100%) diff --git a/packages/core/src/lib.rs b/packages/core/src/lib.rs index 4c528e87f..f8b632917 100644 --- a/packages/core/src/lib.rs +++ b/packages/core/src/lib.rs @@ -16,7 +16,6 @@ pub(crate) mod component; pub(crate) mod diff; pub(crate) mod diff_stack; pub(crate) mod hooklist; -pub(crate) mod hooks; pub(crate) mod lazynodes; pub(crate) mod mutations; pub(crate) mod nodes; @@ -26,15 +25,11 @@ pub(crate) mod test_dom; pub(crate) mod util; pub(crate) mod virtual_dom; -#[cfg(feature = "debug_vdom")] -pub mod debug_dom; - pub(crate) mod innerlude { pub use crate::component::*; pub(crate) use crate::diff::*; pub use crate::diff_stack::*; pub(crate) use crate::hooklist::*; - pub use crate::hooks::*; pub use crate::lazynodes::*; pub use crate::mutations::*; pub use crate::nodes::*; @@ -56,7 +51,6 @@ pub use crate::innerlude::{ pub mod prelude { pub use crate::component::{fc_to_builder, Fragment, Properties, Scope}; - pub use crate::hooks::*; pub use crate::innerlude::Context; pub use crate::innerlude::{DioxusElement, Element, LazyNodes, NodeFactory, ScopeChildren, FC}; pub use crate::nodes::VNode; diff --git a/packages/core/src/debug_dom.rs b/packages/core/src/old/debug_dom.rs similarity index 100% rename from packages/core/src/debug_dom.rs rename to packages/core/src/old/debug_dom.rs diff --git a/packages/core/src/hooks.rs b/packages/core/src/old/hooks.rs similarity index 100% rename from packages/core/src/hooks.rs rename to packages/core/src/old/hooks.rs diff --git a/packages/core/src/virtual_dom.rs b/packages/core/src/virtual_dom.rs index 034a29a62..5531e4ff2 100644 --- a/packages/core/src/virtual_dom.rs +++ b/packages/core/src/virtual_dom.rs @@ -69,8 +69,6 @@ use std::{ pub struct VirtualDom { base_scope: ScopeId, - root_fc: Box, - root_props: Rc, // we need to keep the allocation around, but we don't necessarily use it @@ -85,8 +83,6 @@ pub struct VirtualDom { pending_futures: FxHashSet, pending_messages: VecDeque, dirty_scopes: IndexSet, - - in_progress: bool, } // Methods to create the VirtualDom @@ -179,21 +175,15 @@ impl VirtualDom { receiver, sender, - root_fc: todo!(), root_props: todo!(), _root_caller: todo!(), pending_messages: VecDeque::new(), pending_futures: Default::default(), dirty_scopes: Default::default(), - - in_progress: false, } } -} -// Public utility methods -impl VirtualDom { /// Get the [`ScopeState`] for the root component. /// /// This is useful for traversing the tree from the root for heuristics or alternsative renderers that use Dioxus @@ -233,10 +223,7 @@ impl VirtualDom { pub fn has_any_work(&self) -> bool { !(self.dirty_scopes.is_empty() && self.pending_messages.is_empty()) } -} -// Methods to actually run the VirtualDOM -impl VirtualDom { /// Waits for the scheduler to have work /// This lets us poll async tasks during idle periods without blocking the main thread. pub async fn wait_for_work(&mut self) { @@ -532,7 +519,7 @@ impl VirtualDom { } } - pub fn run_scope(&self, id: &ScopeId) -> bool { + fn run_scope(&self, id: &ScopeId) -> bool { let scope = self .scopes .get_scope(id) @@ -571,11 +558,11 @@ impl VirtualDom { // Todo: see if we can add stronger guarantees around internal bookkeeping and failed component renders. if let Some(key) = render(scope) { - todo!("attach the niode"); + // todo!("attach the niode"); // let new_head = builder.into_vnode(NodeFactory { // bump: &scope.frames.wip_frame().bump, // }); - log::debug!("Render is successful"); + // log::debug!("Render is successful"); // the user's component succeeded. We can safely cycle to the next frame // scope.frames.wip_frame_mut().head_node = unsafe { std::mem::transmute(new_head) };