mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 06:44:17 +00:00
This commit is contained in:
parent
bd86125629
commit
02e2948e00
4 changed files with 23 additions and 4 deletions
|
@ -1,6 +1,4 @@
|
|||
use leptos_reactive::Scope;
|
||||
#[cfg(all(target_arch = "wasm32", feature = "web"))]
|
||||
use wasm_bindgen::UnwrapThrowExt;
|
||||
|
||||
/// Represents the different possible values a single class on an element could have,
|
||||
/// allowing you to do fine-grained updates to single items
|
||||
|
|
|
@ -288,7 +288,11 @@ where
|
|||
S: PartialEq + Debug + Clone + 'static,
|
||||
T: 'static,
|
||||
{
|
||||
r.load(false)
|
||||
SUPPRESS_RESOURCE_LOAD.with(|s| {
|
||||
if !s.get() {
|
||||
r.load(false)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(feature = "hydrate")]
|
||||
|
@ -741,3 +745,12 @@ impl<S, T> UnserializableResource for ResourceState<S, T> {
|
|||
self
|
||||
}
|
||||
}
|
||||
|
||||
thread_local! {
|
||||
static SUPPRESS_RESOURCE_LOAD: Cell<bool> = Cell::new(false);
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub fn suppress_resource_load(suppress: bool) {
|
||||
SUPPRESS_RESOURCE_LOAD.with(|w| w.set(suppress));
|
||||
}
|
||||
|
|
|
@ -77,6 +77,12 @@ where
|
|||
class: Option<AttributeValue>,
|
||||
children: Children,
|
||||
) -> HtmlElement<leptos::html::A> {
|
||||
#[cfg(not(any(feature = "hydrate", feature = "csr")))]
|
||||
_ = state;
|
||||
|
||||
#[cfg(not(any(feature = "hydrate", feature = "csr")))]
|
||||
_ = replace;
|
||||
|
||||
let location = use_location(cx);
|
||||
let is_active = create_memo(cx, move |_| match href.get() {
|
||||
None => false,
|
||||
|
|
|
@ -25,7 +25,9 @@ where
|
|||
let branches = PossibleBranchContext::default();
|
||||
provide_context(cx, branches.clone());
|
||||
|
||||
let _ = app_fn(cx).into_view(cx);
|
||||
leptos::suppress_resource_load(true);
|
||||
_ = app_fn(cx).into_view(cx);
|
||||
leptos::suppress_resource_load(false);
|
||||
|
||||
let branches = branches.0.borrow();
|
||||
branches
|
||||
|
|
Loading…
Reference in a new issue