mirror of
https://github.com/adoyle0/leptos-use.git
synced 2025-01-23 09:09:21 -05:00
fixed a deadlock with use_cookie
This commit is contained in:
parent
eb73bff3cd
commit
a90c96910f
1 changed files with 11 additions and 14 deletions
|
@ -188,22 +188,19 @@ where
|
||||||
if !has_expired {
|
if !has_expired {
|
||||||
let ssr_cookies_header_getter = Arc::clone(&ssr_cookies_header_getter);
|
let ssr_cookies_header_getter = Arc::clone(&ssr_cookies_header_getter);
|
||||||
|
|
||||||
jar.update_value(|jar| {
|
let new_cookie = jar.try_update_value(|jar| {
|
||||||
if let Some(new_jar) = load_and_parse_cookie_jar(ssr_cookies_header_getter) {
|
*jar = load_and_parse_cookie_jar(ssr_cookies_header_getter)?;
|
||||||
*jar = new_jar;
|
jar.get(cookie_name)
|
||||||
|
.and_then(|c| {
|
||||||
set_cookie.set(
|
C::decode(c.value())
|
||||||
jar.get(cookie_name)
|
.map_err(|err| on_error(CodecError::Decode(err)))
|
||||||
.and_then(|c| {
|
.ok()
|
||||||
C::decode(c.value())
|
})
|
||||||
.map_err(|err| on_error(CodecError::Decode(err)))
|
.or(default_value)
|
||||||
.ok()
|
|
||||||
})
|
|
||||||
.or(default_value),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
set_cookie.set(new_cookie.flatten());
|
||||||
|
|
||||||
handle_expiration(delay, set_cookie);
|
handle_expiration(delay, set_cookie);
|
||||||
} else {
|
} else {
|
||||||
debug_warn!(
|
debug_warn!(
|
||||||
|
|
Loading…
Add table
Reference in a new issue