more progress updating tui

This commit is contained in:
Evan Almloff committed 2022-12-05 09:44:43 -06:00
1 parent 8c07b4059f
commit 11b37ee141
11 files changed
+44 -64

No files matched your search

-3
View File
@@ -69,7 +69,6 @@ impl VirtualDom {
)
}
println!("reclaiming {:?}", el);
self.elements.try_remove(el.0)
}
@@ -95,9 +94,7 @@ impl VirtualDom {
// Drop all the hooks once the children are dropped
// this means we'll drop hooks bottom-up
for hook in scope.hook_list.get_mut().drain(..) {
println!("dropping hook !");
drop(unsafe { BumpBox::from_raw(hook) });
println!("hook dropped !");
}
}
-5
View File
@@ -388,11 +388,6 @@ impl<'b> VirtualDom {
// Set the placeholder of the scope
self.scopes[scope.0].placeholder.set(Some(new_id));
println!(
"assigning id {:?} to path {:?}, template: {:?}",
new_id, &template.template.node_paths, template.template
);
// Since the placeholder is already in the DOM, we don't create any new nodes
self.mutations.push(AssignId {
id: new_id,
-15
View File
@@ -61,17 +61,10 @@ impl<'b> VirtualDom {
}
fn diff_node(&mut self, left_template: &'b VNode<'b>, right_template: &'b VNode<'b>) {
println!(
"diffing node {:#?},\n\n{:#?}",
left_template.template.name, right_template.template.name
);
if left_template.template.name != right_template.template.name {
return self.light_diff_templates(left_template, right_template);
}
println!("diffing attributs...");
for (left_attr, right_attr) in left_template
.dynamic_attrs
.iter()
@@ -106,8 +99,6 @@ impl<'b> VirtualDom {
}
}
println!("diffing dyn nodes...");
for (idx, (left_node, right_node)) in left_template
.dynamic_nodes
.iter()
@@ -133,8 +124,6 @@ impl<'b> VirtualDom {
};
}
println!("applying roots...");
// Make sure the roots get transferred over
for (left, right) in left_template
.root_ids
@@ -396,8 +385,6 @@ impl<'b> VirtualDom {
"all siblings must be keyed or all siblings must be non-keyed"
);
println!("Diffing fragment {:?}, {:?}", old.len(), new.len());
if new_is_keyed && old_is_keyed {
self.diff_keyed_children(old, new);
} else {
@@ -420,8 +407,6 @@ impl<'b> VirtualDom {
debug_assert!(!new.is_empty());
debug_assert!(!old.is_empty());
println!("Diffing non keyed children");
match dbg!(old.len().cmp(&new.len())) {
Ordering::Greater => self.remove_nodes(&old[new.len()..]),
Ordering::Less => self.create_and_insert_after(&new[old.len()..], old.last().unwrap()),
-16
View File
@@ -40,8 +40,6 @@ impl VirtualDom {
}
pub(crate) fn handle_suspense_wakeup(&mut self, id: SuspenseId) {
println!("suspense notified");
let leaf = self
.scheduler
.leaves
@@ -67,13 +65,6 @@ impl VirtualDom {
// safety: we're not going to modify the suspense context but we don't want to make a clone of it
let fiber = self.acquire_suspense_boundary(leaf.scope_id);
println!("ready pool");
println!(
"Existing mutations {:?}, scope {:?}",
fiber.mutations, fiber.id
);
let scope = &mut self.scopes[scope_id.0];
let arena = scope.current_frame();
@@ -106,16 +97,9 @@ impl VirtualDom {
std::mem::swap(&mut self.mutations, mutations);
if fiber.waiting_on.borrow().is_empty() {
println!("fiber is finished!");
self.finished_fibers.push(fiber.id);
} else {
println!("fiber is not finished {:?}", fiber.waiting_on);
}
} else {
println!("nodes arent right");
}
} else {
println!("not ready");
}
}
}
-7
View File
@@ -362,8 +362,6 @@ impl VirtualDom {
let target_path = el_ref.path;
for (idx, attr) in template.dynamic_attrs.iter().enumerate() {
println!("{:?} \n {:?} \n {:?}", attr, name, element);
let this_path = template.template.attr_paths[idx];
// listeners are required to be prefixed with "on", but they come back to the virtualdom with that missing
@@ -385,8 +383,6 @@ impl VirtualDom {
}
}
println!("calling listeners: {:?}", listeners);
// Now that we've accumulated all the parent attributes for the target element, call them in reverse order
// We check the bubble state between each call to see if the event has been stopped from bubbling
for listener in listeners.drain(..).rev() {
@@ -403,8 +399,6 @@ impl VirtualDom {
parent_path = template.parent.and_then(|id| self.elements.get(id.0));
}
println!("all listeners exhausted");
}
/// Wait for the scheduler to have any work.
@@ -527,7 +521,6 @@ impl VirtualDom {
///
/// If no suspense trees are present
pub async fn render_with_deadline(&mut self, deadline: impl Future<Output = ()>) -> Mutations {
println!("render with deadline");
pin_mut!(deadline);
loop {