diff --git a/src/storage/use_storage.rs b/src/storage/use_storage.rs index e98591e..1c31fea 100644 --- a/src/storage/use_storage.rs +++ b/src/storage/use_storage.rs @@ -272,13 +272,6 @@ where } }; - // Fetch initial value - if delay_during_hydration && leptos::leptos_dom::HydrationCtx::is_hydrating() { - request_animation_frame(fetch_from_storage.clone()); - } else { - fetch_from_storage(); - } - // Fires when storage needs to be fetched let notify = create_trigger(); @@ -329,6 +322,13 @@ where ); } + // Fetch initial value + if delay_during_hydration && leptos::leptos_dom::HydrationCtx::is_hydrating() { + request_animation_frame(fetch_from_storage.clone()); + } else { + fetch_from_storage(); + } + if listen_to_storage_changes { let check_key = key.as_ref().to_owned(); // Listen to global storage events