From d33d8b5ddac452c585576137af847eaa414c82a1 Mon Sep 17 00:00:00 2001 From: Evan Almloff Date: Wed, 3 Apr 2024 16:32:15 -0500 Subject: [PATCH] fix hydration for non-bubbling events --- packages/html/Cargo.toml | 1 + packages/html/src/events.rs | 5 ++++- packages/ssr/src/renderer.rs | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/html/Cargo.toml b/packages/html/Cargo.toml index e9142f128d..fc3ee0e8fc 100644 --- a/packages/html/Cargo.toml +++ b/packages/html/Cargo.toml @@ -26,6 +26,7 @@ tokio = { workspace = true, features = ["fs", "io-util"], optional = true } rfd = { version = "0.14", optional = true } futures-channel = { workspace = true } serde_json = { version = "1", optional = true } +tracing.workspace = true [dependencies.web-sys] optional = true diff --git a/packages/html/src/events.rs b/packages/html/src/events.rs index 0a761f719c..b81d2b9ab9 100644 --- a/packages/html/src/events.rs +++ b/packages/html/src/events.rs @@ -348,7 +348,10 @@ pub fn event_bubbles(evt: &str) -> bool { "transitionend" => true, "toggle" => true, "mounted" => false, - _ => true, + _ => { + tracing::warn!("Unknown event name: {evt}"); + true + } } } diff --git a/packages/ssr/src/renderer.rs b/packages/ssr/src/renderer.rs index 63bbaddb7d..60813e0ad6 100644 --- a/packages/ssr/src/renderer.rs +++ b/packages/ssr/src/renderer.rs @@ -197,7 +197,7 @@ impl Renderer { // then write any listeners for name in accumulated_listeners.drain(..) { write!(buf, ",{}:", &name[2..])?; - write!(buf, "{}", dioxus_html::event_bubbles(name) as u8)?; + write!(buf, "{}", dioxus_html::event_bubbles(&name[2..]) as u8)?; } }