Skip to content

Commit bfeda93

Browse files
committed
fix(app): gate the rest of the leptos-use stuff on hydrate
1 parent 080eac7 commit bfeda93

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

crates/site-app/src/components/navbar/org_selector.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,16 @@ pub(super) fn OrgSelectorPopover(user: AuthUser) -> impl IntoView {
2727
};
2828

2929
// close on click outside
30+
#[cfg(feature = "hydrate")]
3031
let _ = on_click_outside(popover_ref, move |_| {
3132
if is_open() {
3233
is_open.set(false);
3334
}
3435
});
3536

3637
// close on `Escape` key
37-
let window = use_window();
38-
let _ = use_event_listener(window, keydown, move |evt| {
38+
#[cfg(feature = "hydrate")]
39+
let _ = use_event_listener(use_window(), keydown, move |evt| {
3940
if evt.key() == "Escape" && is_open.get() {
4041
is_open.set(false);
4142
}

crates/site-app/src/components/refetch_while_focused.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@ use std::{fmt::Debug, hash::Hash, time::Duration};
33
use leptos::prelude::*;
44
use leptos_fetch::{QueryClient, QueryScope};
55
use leptos_use::{use_interval_fn, use_window_focus};
6-
use serde::{de::DeserializeOwned, Serialize};
76

87
pub fn refetch_while_focused<
9-
K: Clone + Hash + PartialEq + Debug + Send + Sync + 'static,
10-
KF: Fn() -> K + Copy + Send + Sync + 'static,
11-
R: Clone + Debug + DeserializeOwned + Serialize + Send + Sync + 'static,
8+
K: Clone + Hash + PartialEq + Debug + 'static,
9+
KF: Fn() -> K + Copy + 'static,
10+
R: Clone + Debug + 'static,
1211
>(
13-
key_fn: KF,
14-
query_scope: QueryScope<K, R>,
15-
period: Duration,
12+
#[cfg_attr(feature = "hydrate", allow(dead_code))] key_fn: KF,
13+
#[cfg_attr(feature = "hydrate", allow(dead_code))] query_scope: QueryScope<
14+
K,
15+
R,
16+
>,
17+
#[cfg_attr(feature = "hydrate", allow(dead_code))] period: Duration,
1618
) {
1719
#[cfg(feature = "hydrate")]
1820
{

0 commit comments

Comments
 (0)