codify "platform" into resolution logic, server-fn/fullstack overhaul (#4596)
overhaul dioxus fullstack using a new implementation of server_fn This PR is a complete rewrite of dioxus fullstack designed to improve compatibility with axum and to fix a number of compilation errors based on feature flag unification plumbing through macros.
This commit is contained in:
1 parent
8421c3aef0
commit
f2b1c6d97f
424 files changed
+17284
-6624
No files matched your search
@@ -1,13 +1,11 @@
|
||||
use crate::{
|
||||
any_props::{AnyProps, BoxedAnyProps},
|
||||
innerlude::{throw_error, RenderError, ScopeOrder, ScopeState},
|
||||
nodes::AsVNode,
|
||||
scope_context::{Scope, SuspenseLocation},
|
||||
scopes::ScopeId,
|
||||
virtual_dom::VirtualDom,
|
||||
ReactiveContext,
|
||||
Element, ReactiveContext,
|
||||
};
|
||||
use crate::{Element, VNode};
|
||||
|
||||
impl VirtualDom {
|
||||
pub(super) fn new_scope(
|
||||
@@ -39,7 +37,6 @@ impl VirtualDom {
|
||||
});
|
||||
|
||||
self.runtime.create_scope(scope_runtime);
|
||||
tracing::trace!("created scope {id:?} with parent {parent_id:?}");
|
||||
|
||||
scope
|
||||
}
|
||||
@@ -79,7 +76,14 @@ impl VirtualDom {
|
||||
// the component runs, it returns a clone of the last rsx that was returned from
|
||||
// that resource. If we don't deep clone the VNode and the resource changes, then
|
||||
// we could end up diffing two different versions of the same mounted node
|
||||
let mut render_return = render_return.deep_clone();
|
||||
let mut render_return = match render_return {
|
||||
Ok(node) => Ok(node.deep_clone()),
|
||||
Err(RenderError::Error(err)) => Err(RenderError::Error(err.clone())),
|
||||
Err(RenderError::Suspended(fut)) => {
|
||||
Err(RenderError::Suspended(fut.deep_clone()))
|
||||
}
|
||||
};
|
||||
|
||||
self.handle_element_return(&mut render_return, scope_id, &scope.state());
|
||||
render_return
|
||||
})
|
||||
@@ -103,13 +107,12 @@ impl VirtualDom {
|
||||
/// Insert any errors, or suspended tasks from an element return into the runtime
|
||||
fn handle_element_return(&self, node: &mut Element, scope_id: ScopeId, scope_state: &Scope) {
|
||||
match node {
|
||||
Err(RenderError::Aborted(e)) => {
|
||||
Err(RenderError::Error(e)) => {
|
||||
tracing::error!(
|
||||
"Error while rendering component `{}`:\n{e}",
|
||||
scope_state.name
|
||||
);
|
||||
throw_error(e.clone());
|
||||
e.render = VNode::placeholder();
|
||||
}
|
||||
Err(RenderError::Suspended(e)) => {
|
||||
let task = e.task();
|
||||
@@ -136,7 +139,6 @@ impl VirtualDom {
|
||||
.suspended_tasks
|
||||
.set(self.runtime.suspended_tasks.get() + 1);
|
||||
}
|
||||
e.placeholder = VNode::placeholder();
|
||||
}
|
||||
Ok(_) => {
|
||||
// If the render was successful, we can move the render generation forward by one
|
||||
|
||||
Reference in new issue
Block a user