Improve warnings when trying to update outside of pending suspense boundaries on the server (#2575)

* Improve warnings when trying to update outside of pending suspense boundaries on the server

* remove suspense resolve log
This commit is contained in:
Evan Almloff authored and GitHub committed 2024-07-17 19:32:33 -07:00
1 parent 88af3e7eff
commit e794be5d78
14 files changed
+409 -313

No files matched your search

@@ -1,6 +1,7 @@
use dioxus_lib::prelude::dioxus_core::DynamicNode;
use dioxus_lib::prelude::{
has_context, try_consume_context, ScopeId, SuspenseBoundaryProps, VNode, VirtualDom,
has_context, try_consume_context, ScopeId, SuspenseBoundaryProps, SuspenseContext, VNode,
VirtualDom,
};
use serde::Serialize;
@@ -49,9 +50,11 @@ impl super::HTMLData {
// then continue to any children
if let Some(scope) = vdom.get_scope(scope) {
// If this is a suspense boundary, move into the children first (even if they are suspended) because that will be run first on the client
if let Some(suspense_boundary) = SuspenseBoundaryProps::downcast_from_scope(scope) {
if let Some(node) = suspense_boundary.suspended_nodes.as_ref() {
self.take_from_vnode(vdom, node);
if let Some(suspense_boundary) =
SuspenseContext::downcast_suspense_boundary_from_scope(&vdom.runtime(), scope.id())
{
if let Some(node) = suspense_boundary.suspended_nodes() {
self.take_from_vnode(vdom, &node);
}
}
if let Some(node) = scope.try_root_node() {