Skip to content

Commit b87e2e8

Browse files
authored
Fix/240410 (#162)
* pref: unused variable warning * fix: teleport hydrate error * style: leptosfmt
1 parent 1af5b25 commit b87e2e8

File tree

6 files changed

+25
-19
lines changed

6 files changed

+25
-19
lines changed

thaw/src/drawer/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ pub fn Drawer(
113113
>
114114
<div
115115
class=class_list![
116-
"thaw-drawer", move || format!("thaw-drawer--placement-{}", placement
117-
.get()), class.map(| c | move || c.get())
116+
"thaw-drawer", move || format!("thaw-drawer--placement-{}",
117+
placement.get()), class.map(| c | move || c.get())
118118
]
119119

120120
style=move || display.get()

thaw/src/layout/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ pub fn Layout(
5858
)
5959
})
6060
>
61+
6162
{children()}
6263
</Scrollbar>
6364
</div>

thaw/src/modal/mod.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub fn Modal(
6464
});
6565

6666
view! {
67-
<Teleport immediate=show.signal()>
67+
<Teleport immediate=show.signal()>
6868
<FocusTrap disabled=!close_on_esc active=show.signal() on_esc>
6969
<div
7070
class="thaw-modal-container"
@@ -73,7 +73,13 @@ pub fn Modal(
7373
>
7474
<Scrollbar
7575
content_style="min-height: 100%; display: flex;"
76-
style=Signal::derive(move || if displayed.get() { String::new() } else { String::from("display: none") })
76+
style=Signal::derive(move || {
77+
if displayed.get() {
78+
String::new()
79+
} else {
80+
String::from("display: none")
81+
}
82+
})
7783
comp_ref=scrollbar_ref
7884
>
7985
<CSSTransition

thaw/src/scrollbar/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -291,12 +291,14 @@ pub fn Scrollbar(
291291
class=class_list![
292292
"thaw-scrollbar__content", content_class.map(| c | move || c.get())
293293
]
294+
294295
style=move || {
295296
format!(
296297
"width: fit-content; {}",
297298
content_style.as_ref().map_or(String::new(), |s| s.get()),
298299
)
299300
}
301+
300302
ref=content_ref
301303
>
302304
{children()}

thaw_components/src/focus_trap/mod.rs

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
use leptos::{leptos_dom::helpers::WindowListenerHandle, *};
2-
use std::cell::RefCell;
1+
use leptos::*;
32

43
#[cfg(any(feature = "csr", feature = "hydrate"))]
54
thread_local! {
6-
static STACK: RefCell<Vec<uuid::Uuid>> = Default::default();
5+
static STACK: std::cell::RefCell<Vec<uuid::Uuid>> = Default::default();
76
}
87

98
#[component]
@@ -15,6 +14,7 @@ pub fn FocusTrap(
1514
) -> impl IntoView {
1615
#[cfg(any(feature = "csr", feature = "hydrate"))]
1716
if disabled == false {
17+
use leptos::leptos_dom::helpers::WindowListenerHandle;
1818
let esc_handle = StoredValue::new(None::<WindowListenerHandle>);
1919
let id = StoredValue::new(uuid::Uuid::new_v4());
2020

@@ -55,5 +55,12 @@ pub fn FocusTrap(
5555
});
5656
}
5757

58+
#[cfg(not(any(feature = "csr", feature = "hydrate")))]
59+
{
60+
let _ = disabled;
61+
let _ = active;
62+
let _ = on_esc;
63+
}
64+
5865
children()
5966
}

thaw_components/src/teleport/mod.rs

+2-12
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,7 @@ pub fn Teleport(
6060
} else {
6161
let _ = mount;
6262
let _ = immediate;
63-
#[cfg(not(feature = "ssr"))]
64-
{
65-
let _ = element;
66-
let _ = children;
67-
}
68-
#[cfg(feature = "ssr")]
69-
if element.is_none() {
70-
if let Some(children) = children {
71-
// Consumed hydration `id`
72-
let _ = children();
73-
}
74-
}
63+
let _ = element;
64+
let _ = children;
7565
}}
7666
}

0 commit comments

Comments
 (0)