diff --git a/packages/core/src/runtime.rs b/packages/core/src/runtime.rs index 80f5fbe54..2b2809019 100644 --- a/packages/core/src/runtime.rs +++ b/packages/core/src/runtime.rs @@ -94,9 +94,13 @@ impl Runtime { /// /// Useful in a limited number of scenarios pub fn on_scope(&self, id: ScopeId, f: impl FnOnce() -> O) -> O { - self.scope_stack.borrow_mut().push(id); + { + self.scope_stack.borrow_mut().push(id); + } let o = f(); - self.scope_stack.borrow_mut().pop(); + { + self.scope_stack.borrow_mut().pop(); + } o }