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:
Jonathan Kelley authored and GitHub committed 2025-10-03 18:26:19 -07:00
1 parent 8421c3aef0
commit f2b1c6d97f
424 files changed
+17284 -6624

No files matched your search

+41 -4
View File
@@ -1,6 +1,6 @@
use crate::{
any_props::BoxedAnyProps, nodes::AsVNode, reactive_context::ReactiveContext,
scope_context::Scope, Element, Runtime, VNode,
any_props::BoxedAnyProps, reactive_context::ReactiveContext, scope_context::Scope, Element,
RenderError, Runtime, VNode,
};
use std::{cell::Ref, rc::Rc};
@@ -76,11 +76,44 @@ pub struct ScopeState {
pub(crate) context_id: ScopeId,
/// The last node that has been rendered for this component. This node may not ben mounted
/// During suspense, this component can be rendered in the background multiple times
pub(crate) last_rendered_node: Option<Element>,
pub(crate) last_rendered_node: Option<LastRenderedNode>,
pub(crate) props: BoxedAnyProps,
pub(crate) reactive_context: ReactiveContext,
}
#[derive(Clone, PartialEq, Debug)]
pub enum LastRenderedNode {
Real(VNode),
Placeholder(VNode, RenderError),
}
impl std::ops::Deref for LastRenderedNode {
type Target = VNode;
fn deref(&self) -> &Self::Target {
match self {
LastRenderedNode::Real(vnode) => vnode,
LastRenderedNode::Placeholder(vnode, _err) => vnode,
}
}
}
impl LastRenderedNode {
pub fn new(node: Element) -> Self {
match node {
Ok(vnode) => LastRenderedNode::Real(vnode),
Err(err) => LastRenderedNode::Placeholder(VNode::placeholder(), err),
}
}
pub fn as_vnode(&self) -> &VNode {
match self {
LastRenderedNode::Real(vnode) => vnode,
LastRenderedNode::Placeholder(vnode, _err) => vnode,
}
}
}
impl Drop for ScopeState {
fn drop(&mut self) {
self.runtime.remove_scope(self.context_id);
@@ -104,7 +137,11 @@ impl ScopeState {
///
/// Returns [`None`] if the tree has not been built yet.
pub fn try_root_node(&self) -> Option<&VNode> {
self.last_rendered_node.as_ref().map(AsVNode::as_vnode)
match &self.last_rendered_node {
Some(LastRenderedNode::Real(vnode)) => Some(vnode),
Some(LastRenderedNode::Placeholder(vnode, _)) => Some(vnode),
None => None,
}
}
/// Returns the scope id of this [`ScopeState`].