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
+21
-1
@@ -88,12 +88,32 @@ pub async fn run(mut virtual_dom: VirtualDom, web_config: Config) -> ! {
|
||||
const decoded = atob(window.initial_dioxus_hydration_data);
|
||||
return Uint8Array.from(decoded, (c) => c.charCodeAt(0))
|
||||
}
|
||||
export function get_initial_hydration_debug_types() {
|
||||
return window.initial_dioxus_hydration_debug_types;
|
||||
}
|
||||
export function get_initial_hydration_debug_locations() {
|
||||
return window.initial_dioxus_hydration_debug_locations;
|
||||
}
|
||||
"#)]
|
||||
extern "C" {
|
||||
fn get_initial_hydration_data() -> js_sys::Uint8Array;
|
||||
fn get_initial_hydration_debug_types() -> Option<Vec<String>>;
|
||||
fn get_initial_hydration_debug_locations() -> Option<Vec<String>>;
|
||||
}
|
||||
let hydration_data = get_initial_hydration_data().to_vec();
|
||||
let server_data = HTMLDataCursor::from_serialized(&hydration_data);
|
||||
|
||||
// If we are running in debug mode, also get the debug types and locations
|
||||
#[cfg(debug_assertions)]
|
||||
let debug_types = get_initial_hydration_debug_types();
|
||||
#[cfg(not(debug_assertions))]
|
||||
let debug_types = None;
|
||||
#[cfg(debug_assertions)]
|
||||
let debug_locations = get_initial_hydration_debug_locations();
|
||||
#[cfg(not(debug_assertions))]
|
||||
let debug_locations = None;
|
||||
|
||||
let server_data =
|
||||
HTMLDataCursor::from_serialized(&hydration_data, debug_types, debug_locations);
|
||||
// If the server serialized an error into the root suspense boundary, throw it into the root scope
|
||||
if let Some(error) = server_data.error() {
|
||||
virtual_dom.in_runtime(|| dioxus_core::ScopeId::APP.throw_error(error));
|
||||
|
||||
Reference in new issue
Block a user