mirror of
https://github.com/adoyle0/leptos-use.git
synced 2025-01-22 16:49:22 -05:00
use_storage now always writes the default value to storage if the key doesn’t exist
This commit is contained in:
parent
85376f8165
commit
c26a96d8a6
1 changed files with 7 additions and 7 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue