dioxus_fullstack/document/
web.rs1#![allow(unused)]
2use dioxus_lib::{document::*, prelude::queue_effect};
5use dioxus_web::WebDocument;
6
7fn head_element_written_on_server() -> bool {
8 dioxus_web::take_server_data()
9 .ok()
10 .flatten()
11 .unwrap_or_default()
12}
13
14#[derive(Clone)]
16pub struct FullstackWebDocument;
17
18impl Document for FullstackWebDocument {
19 fn eval(&self, js: String) -> Eval {
20 WebDocument.eval(js)
21 }
22
23 fn set_title(&self, title: String) {
25 WebDocument.set_title(title);
26 }
27
28 fn create_meta(&self, props: MetaProps) {
30 WebDocument.create_meta(props);
31 }
32
33 fn create_script(&self, props: ScriptProps) {
35 WebDocument.create_script(props);
36 }
37
38 fn create_style(&self, props: StyleProps) {
40 WebDocument.create_style(props);
41 }
42
43 fn create_link(&self, props: LinkProps) {
45 WebDocument.create_link(props);
46 }
47
48 fn create_head_component(&self) -> bool {
49 !head_element_written_on_server()
50 }
51}