Fix hydration of suspense fragments that contain text nodes (#3287)
* Fix hydration of suspense fragments that contain text nodes * fix release builds * disable link deduplication * restore meta tag deduplication * Add a test for the failed hydration case * make changes to the document trait non-breaking * remove info log from server future hook * restore default implementation - this was also a breaking change * fix semver breakage * clean up server_future * Cleanup unused code * fix clippy --------- Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
1 parent
57d637184f
commit
d41ab3a756
33 files changed
+644
-222
No files matched your search
@@ -1,4 +1,8 @@
|
||||
use dioxus_document::{Document, Eval, EvalError, Evaluator};
|
||||
use dioxus_core::prelude::queue_effect;
|
||||
use dioxus_document::{
|
||||
create_element_in_head, Document, Eval, EvalError, Evaluator, LinkProps, MetaProps,
|
||||
ScriptProps, StyleProps,
|
||||
};
|
||||
use generational_box::{AnyStorage, GenerationalBox, UnsyncStorage};
|
||||
|
||||
use crate::{query::Query, DesktopContext};
|
||||
@@ -7,6 +11,7 @@ use crate::{query::Query, DesktopContext};
|
||||
pub const NATIVE_EVAL_JS: &str = include_str!("./js/native_eval.js");
|
||||
|
||||
/// Represents the desktop-target's provider of evaluators.
|
||||
#[derive(Clone)]
|
||||
pub struct DesktopDocument {
|
||||
pub(crate) desktop_ctx: DesktopContext,
|
||||
}
|
||||
@@ -25,6 +30,46 @@ impl Document for DesktopDocument {
|
||||
fn set_title(&self, title: String) {
|
||||
self.desktop_ctx.window.set_title(&title);
|
||||
}
|
||||
|
||||
/// Create a new meta tag in the head
|
||||
fn create_meta(&self, props: MetaProps) {
|
||||
let myself = self.clone();
|
||||
queue_effect(move || {
|
||||
myself.eval(create_element_in_head("meta", &props.attributes(), None));
|
||||
});
|
||||
}
|
||||
|
||||
/// Create a new script tag in the head
|
||||
fn create_script(&self, props: ScriptProps) {
|
||||
let myself = self.clone();
|
||||
queue_effect(move || {
|
||||
myself.eval(create_element_in_head(
|
||||
"script",
|
||||
&props.attributes(),
|
||||
props.script_contents().ok(),
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
/// Create a new style tag in the head
|
||||
fn create_style(&self, props: StyleProps) {
|
||||
let myself = self.clone();
|
||||
queue_effect(move || {
|
||||
myself.eval(create_element_in_head(
|
||||
"style",
|
||||
&props.attributes(),
|
||||
props.style_contents().ok(),
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
/// Create a new link tag in the head
|
||||
fn create_link(&self, props: LinkProps) {
|
||||
let myself = self.clone();
|
||||
queue_effect(move || {
|
||||
myself.eval(create_element_in_head("link", &props.attributes(), None));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// Represents a desktop-target's JavaScript evaluator.
|
||||
|
||||
Reference in new issue
Block a user