mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-23 12:43:08 +00:00
fix: make sure to set scope on none
This commit is contained in:
parent
48b1bf2ac1
commit
6b41c9d193
2 changed files with 10 additions and 1 deletions
|
@ -337,6 +337,8 @@ impl<'b> VirtualDom {
|
|||
// Load up a ScopeId for this vcomponent
|
||||
let scope = self.load_scope_from_vcomponent(component);
|
||||
|
||||
component.scope.set(Some(scope));
|
||||
|
||||
match unsafe { self.run_scope(scope).extend_lifetime_ref() } {
|
||||
Ready(t) => self.mount_component(scope, template, t, idx),
|
||||
Aborted(t) => self.mount_aborted(template, t),
|
||||
|
|
|
@ -212,8 +212,12 @@ impl<'b> VirtualDom {
|
|||
) {
|
||||
let m = self.create_component_node(right_template, right, idx);
|
||||
|
||||
let pre_edits = self.mutations.edits.len();
|
||||
|
||||
self.remove_component_node(left, true);
|
||||
|
||||
assert!(self.mutations.edits.len() > pre_edits);
|
||||
|
||||
// We want to optimize the replace case to use one less mutation if possible
|
||||
// Since mutations are done in reverse, the last node removed will be the first in the stack
|
||||
// Instead of *just* removing it, we can use the replace mutation
|
||||
|
@ -873,7 +877,10 @@ impl<'b> VirtualDom {
|
|||
}
|
||||
|
||||
fn remove_component_node(&mut self, comp: &VComponent, gen_muts: bool) {
|
||||
let scope = comp.scope.take().unwrap();
|
||||
let scope = comp
|
||||
.scope
|
||||
.take()
|
||||
.expect("VComponents to always have a scope");
|
||||
|
||||
match unsafe { self.scopes[scope.0].root_node().extend_lifetime_ref() } {
|
||||
RenderReturn::Ready(t) => {
|
||||
|
|
Loading…
Reference in a new issue