mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-27 06:30:20 +00:00
chore: clean up scopes
This commit is contained in:
parent
a4ea0ba4fe
commit
9dda7b168b
2 changed files with 3 additions and 8 deletions
|
@ -213,9 +213,7 @@ impl ScopeArena {
|
|||
}
|
||||
|
||||
pub fn collect_garbage(&self, id: ElementId) {
|
||||
let node = self.nodes.borrow_mut().get(id.0).unwrap().clone();
|
||||
// let node = self.nodes.borrow_mut().remove(id.0);
|
||||
// log::debug!("collecting garbage for {:?}, {:?}", id, unsafe { &*node });
|
||||
self.nodes.borrow_mut().remove(id.0);
|
||||
}
|
||||
|
||||
/// This method cleans up any references to data held within our hook list. This prevents mutable aliasing from
|
||||
|
@ -231,8 +229,6 @@ impl ScopeArena {
|
|||
/// This also makes sure that drop order is consistent and predictable. All resources that rely on being dropped will
|
||||
/// be dropped.
|
||||
pub(crate) fn ensure_drop_safety(&self, scope_id: ScopeId) {
|
||||
// log::trace!("Ensuring drop safety for scope {:?}", scope_id);
|
||||
|
||||
if let Some(scope) = self.get_scope(scope_id) {
|
||||
let mut items = scope.items.borrow_mut();
|
||||
|
||||
|
@ -243,7 +239,6 @@ impl ScopeArena {
|
|||
if let Some(scope_id) = comp.scope.get() {
|
||||
self.ensure_drop_safety(scope_id);
|
||||
}
|
||||
|
||||
drop(comp.props.take());
|
||||
});
|
||||
|
||||
|
|
|
@ -449,6 +449,7 @@ impl VirtualDom {
|
|||
/// apply_mutations(mutations);
|
||||
/// }
|
||||
/// ```
|
||||
#[allow(unused)]
|
||||
pub fn work_with_deadline(&mut self, mut deadline: impl FnMut() -> bool) -> Vec<Mutations> {
|
||||
let mut committed_mutations = vec![];
|
||||
|
||||
|
@ -487,13 +488,12 @@ impl VirtualDom {
|
|||
|
||||
committed_mutations.push(mutations);
|
||||
|
||||
// todo: pause the diff machine
|
||||
// if diff_state.work(&mut deadline) {
|
||||
// let DiffState { mutations, .. } = diff_state;
|
||||
|
||||
// for scope in &mutations.dirty_scopes {
|
||||
// self.dirty_scopes.remove(scope);
|
||||
// }
|
||||
|
||||
// committed_mutations.push(mutations);
|
||||
// } else {
|
||||
// // leave the work in an incomplete state
|
||||
|
|
Loading…
Reference in a new issue