remove some unused unsafe blocks

This commit is contained in:
Evan Almloff committed 2024-01-05 11:45:01 -06:00
1 parent 35b461cd09
commit 717f38a5ec
3 files changed
+5 -5

No files matched your search

+3 -3
View File
@@ -993,7 +993,7 @@ impl VirtualDom {
.expect("VComponents to always have a scope");
// Remove the component from the dom
match unsafe { self.get_scope(scope).unwrap().root_node() } {
match self.get_scope(scope).unwrap().root_node() {
RenderReturn::Ready(t) => self.remove_node(t, gen_muts, to),
RenderReturn::Aborted(placeholder) => {
self.remove_placeholder(placeholder, gen_muts, to)
@@ -1012,7 +1012,7 @@ impl VirtualDom {
Some(Placeholder(t)) => t.id.get().unwrap(),
Some(Component(comp)) => {
let scope = comp.scope.get().unwrap();
match unsafe { self.get_scope(scope).unwrap().root_node() } {
match self.get_scope(scope).unwrap().root_node() {
RenderReturn::Ready(t) => self.find_first_element(t),
_ => todo!("cannot handle nonstandard nodes"),
}
@@ -1028,7 +1028,7 @@ impl VirtualDom {
Some(Placeholder(t)) => t.id.get().unwrap(),
Some(Component(comp)) => {
let scope = comp.scope.get().unwrap();
match unsafe { self.get_scope(scope).unwrap().root_node() } {
match self.get_scope(scope).unwrap().root_node() {
RenderReturn::Ready(t) => self.find_last_element(t),
_ => todo!("cannot handle nonstandard nodes"),
}
+1 -1
View File
@@ -34,7 +34,7 @@ impl VirtualDom {
pub(crate) fn run_scope(&mut self, scope_id: ScopeId) -> RenderReturn {
self.runtime.scope_stack.borrow_mut().push(scope_id);
let new_nodes = unsafe {
let new_nodes = {
let scope = &self.scopes[scope_id.0];
let context = scope.context();
+1 -1
View File
@@ -549,7 +549,7 @@ impl VirtualDom {
match unsafe { self.run_scope(ScopeId::ROOT) } {
// Rebuilding implies we append the created elements to the root
RenderReturn::Ready(node) => {
let m = self.create_scope(ScopeId::ROOT, &node);
let m = self.create_scope(ScopeId::ROOT, &node, to);
to.append_children(ElementId(0), m);
}
// If an error occurs, we should try to render the default error component and context where the error occured