Fix templates merging in debug mode in macros (#2828)

* Fix templates merging in debug mode in macros

* Fix clippy

* Fix web-sys scroll to deprecated warning
This commit is contained in:
Evan Almloff authored and GitHub committed 2024-08-13 20:18:54 +00:00
1 parent cab573eefd
commit 959ab67624
5 files changed
+259 -204

No files matched your search

+8 -6
View File
@@ -531,14 +531,16 @@ impl crate::RenderedElementBacking for web_sys::Element {
&self,
behavior: crate::ScrollBehavior,
) -> std::pin::Pin<Box<dyn std::future::Future<Output = crate::MountedResult<()>>>> {
let options = web_sys::ScrollIntoViewOptions::new();
match behavior {
crate::ScrollBehavior::Instant => self.scroll_into_view_with_scroll_into_view_options(
web_sys::ScrollIntoViewOptions::new().behavior(web_sys::ScrollBehavior::Instant),
),
crate::ScrollBehavior::Smooth => self.scroll_into_view_with_scroll_into_view_options(
web_sys::ScrollIntoViewOptions::new().behavior(web_sys::ScrollBehavior::Smooth),
),
crate::ScrollBehavior::Instant => {
options.set_behavior(web_sys::ScrollBehavior::Instant);
}
crate::ScrollBehavior::Smooth => {
options.set_behavior(web_sys::ScrollBehavior::Smooth);
}
}
self.scroll_into_view_with_scroll_into_view_options(&options);
Box::pin(async { Ok(()) })
}