From 0103524d276c6227729b8850bdd951d8216ce613 Mon Sep 17 00:00:00 2001
From: Maccesch
Date: Sat, 27 Jul 2024 19:13:54 +0100
Subject: [PATCH] Release 0.11.0
---
CHANGELOG.md | 2 +-
Cargo.toml | 2 +-
README.md | 4 ++--
docs/book/src/introduction.md | 2 +-
examples/ssr/Cargo.toml | 1 +
examples/ssr/src/app.rs | 4 ++--
src/use_cookie.rs | 37 ++++++++++++++++++++++-------------
7 files changed, 31 insertions(+), 21 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 91aad70..c2d7794 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,7 +3,7 @@
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
-## [Unreleased]
+## [0.11.0] - 2024-07-27
### New Functions 🚀
diff --git a/Cargo.toml b/Cargo.toml
index aa60808..4aa163c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "leptos-use"
-version = "0.10.10"
+version = "0.11.0"
edition = "2021"
authors = ["Marc-Stefan Cassola"]
categories = ["gui", "web-programming"]
diff --git a/README.md b/README.md
index 57516cc..7711119 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@
-
+
@@ -92,4 +92,4 @@ This will create the function file in the src directory, scaffold an example dir
| <= 0.3 | 0.3 |
| 0.4, 0.5, 0.6 | 0.4 |
| 0.7, 0.8, 0.9 | 0.5 |
-| 0.10 | 0.6 |
\ No newline at end of file
+| 0.10, 0.11 | 0.6 |
diff --git a/docs/book/src/introduction.md b/docs/book/src/introduction.md
index f12ec1b..cf0098a 100644
--- a/docs/book/src/introduction.md
+++ b/docs/book/src/introduction.md
@@ -12,6 +12,6 @@
-
+
\ No newline at end of file
diff --git a/examples/ssr/Cargo.toml b/examples/ssr/Cargo.toml
index d0b6e6a..5d71626 100644
--- a/examples/ssr/Cargo.toml
+++ b/examples/ssr/Cargo.toml
@@ -8,6 +8,7 @@ crate-type = ["cdylib", "rlib"]
[dependencies]
axum = { version = "0.7", optional = true }
+codee = "0.1"
console_error_panic_hook = "0.1"
console_log = "1"
cfg-if = "1"
diff --git a/examples/ssr/src/app.rs b/examples/ssr/src/app.rs
index 80b8695..7db0793 100644
--- a/examples/ssr/src/app.rs
+++ b/examples/ssr/src/app.rs
@@ -4,7 +4,7 @@ use leptos::*;
use leptos_meta::*;
use leptos_router::*;
use leptos_use::storage::{use_local_storage, use_local_storage_with_options, UseStorageOptions};
-use leptos_use::utils::FromToStringCodec;
+use codee::string::FromToStringCodec;
use leptos_use::{
use_color_mode_with_options, use_cookie_with_options, use_debounce_fn, use_event_listener,
use_interval, use_intl_number_format, use_preferred_dark, use_timestamp, use_window, ColorMode,
@@ -78,7 +78,7 @@ fn HomePage() -> impl IntoView {
let (test_cookie, _) = use_cookie_with_options::(
"test-cookie",
- UseCookieOptions::::default()
+ UseCookieOptions::::default()
.max_age(3000)
.default_value(Some("Bogus string".to_owned())),
);
diff --git a/src/use_cookie.rs b/src/use_cookie.rs
index 1af6615..d212b18 100644
--- a/src/use_cookie.rs
+++ b/src/use_cookie.rs
@@ -359,6 +359,8 @@ where
#[cfg(feature = "ssr")]
{
if !readonly {
+ let cookie_name = cookie_name.to_owned();
+
create_isomorphic_effect(move |_| {
let value = cookie
.with(|cookie| {
@@ -369,20 +371,27 @@ where
})
})
.flatten();
- jar.update_value(|jar| {
- write_server_cookie(
- cookie_name,
- value,
- jar,
- max_age,
- expires,
- domain,
- path,
- same_site,
- secure,
- http_only,
- ssr_set_cookie,
- )
+
+ jar.update_value({
+ let domain = domain.clone();
+ let path = path.clone();
+ let ssr_set_cookie = Rc::clone(&ssr_set_cookie);
+
+ |jar| {
+ write_server_cookie(
+ &cookie_name,
+ value,
+ jar,
+ max_age,
+ expires,
+ domain,
+ path,
+ same_site,
+ secure,
+ http_only,
+ ssr_set_cookie,
+ )
+ }
});
});
}