From cc984fae5402340a5f94703c13437e2d36959e5c Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Fri, 14 Jul 2023 17:45:48 -0700 Subject: [PATCH] Only check suspense if the component aborted rendering --- packages/core/src/any_props.rs | 3 +-- packages/core/src/scope_arena.rs | 10 ++++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/core/src/any_props.rs b/packages/core/src/any_props.rs index e3a3bdaef..00ccda597 100644 --- a/packages/core/src/any_props.rs +++ b/packages/core/src/any_props.rs @@ -1,11 +1,10 @@ -use std::{ panic::AssertUnwindSafe}; - use crate::{ innerlude::Scoped, nodes::RenderReturn, scopes::{Scope, ScopeState}, Element, }; +use std::panic::AssertUnwindSafe; /// A trait that essentially allows VComponentProps to be used generically /// diff --git a/packages/core/src/scope_arena.rs b/packages/core/src/scope_arena.rs index 39b39f8c4..d058e34de 100644 --- a/packages/core/src/scope_arena.rs +++ b/packages/core/src/scope_arena.rs @@ -83,10 +83,12 @@ impl VirtualDom { id: scope.id, }); - if scope.suspended.get() { - self.suspended_scopes.insert(scope.id); - } else if !self.suspended_scopes.is_empty() { - _ = self.suspended_scopes.remove(&scope.id); + if matches!(allocated, RenderReturn::Aborted(_)) { + if scope.suspended.get() { + self.suspended_scopes.insert(scope.id); + } else if !self.suspended_scopes.is_empty() { + _ = self.suspended_scopes.remove(&scope.id); + } } // rebind the lifetime now that its stored internally