From e1457744f0b71b7b6e0a42b02b2331825a538ed7 Mon Sep 17 00:00:00 2001 From: Ryo Hirayama Date: Wed, 27 Nov 2024 02:43:02 +0900 Subject: [PATCH] Fix hydration race condition (#3240) * Fix mount_to_root * Remove WebsysDom.mount --- packages/interpreter/src/unified_bindings.rs | 3 --- packages/web/src/dom.rs | 4 ---- packages/web/src/lib.rs | 3 --- 3 files changed, 10 deletions(-) diff --git a/packages/interpreter/src/unified_bindings.rs b/packages/interpreter/src/unified_bindings.rs index ea95b25b1..3c17ab52b 100644 --- a/packages/interpreter/src/unified_bindings.rs +++ b/packages/interpreter/src/unified_bindings.rs @@ -44,9 +44,6 @@ mod js { #[extends(BaseInterpreter)] pub struct Interpreter; - fn mount_to_root() { - "{this.appendChildren(this.root, this.stack.length-1);}" - } fn push_root(root: u32) { "{this.pushRoot(this.nodes[$root$]);}" } diff --git a/packages/web/src/dom.rs b/packages/web/src/dom.rs index 3cc3568d2..b46770844 100644 --- a/packages/web/src/dom.rs +++ b/packages/web/src/dom.rs @@ -134,10 +134,6 @@ impl WebsysDom { suspense_hydration_ids: Default::default(), } } - - pub fn mount(&mut self) { - self.interpreter.mount_to_root(); - } } fn walk_event_for_id(event: &web_sys::Event) -> Option<(ElementId, web_sys::Element)> { diff --git a/packages/web/src/lib.rs b/packages/web/src/lib.rs index f15d2462f..991c7661c 100644 --- a/packages/web/src/lib.rs +++ b/packages/web/src/lib.rs @@ -121,9 +121,6 @@ pub async fn run(mut virtual_dom: VirtualDom, web_config: Config) -> ! { websys_dom.flush_edits(); } - // the mutations come back with nothing - we need to actually mount them - websys_dom.mount(); - loop { // if virtual dom has nothing, wait for it to have something before requesting idle time // if there is work then this future resolves immediately.