mirror of
https://github.com/adoyle0/leptos-use.git
synced 2025-01-23 00:59:22 -05:00
use_cookie signal tries to change cookie headers during SSR
Closes #124
This commit is contained in:
parent
0975bdcfef
commit
e192eff406
1 changed files with 27 additions and 23 deletions
|
@ -90,7 +90,9 @@ use std::rc::Rc;
|
|||
/// This works equally well on the server or the client.
|
||||
/// On the server this function reads the cookie from the HTTP request header and writes it back into
|
||||
/// the HTTP response header according to options (if provided).
|
||||
/// The returned `WriteSignal` will not affect the cookie headers on the server.
|
||||
/// The returned `WriteSignal` may not affect the cookie headers on the server! It will try and write
|
||||
/// the headers buy if this happens after the headers have already been streamed to the client then
|
||||
/// this will have no effect.
|
||||
///
|
||||
/// > If you're using `axum` you have to enable the `"axum"` feature in your Cargo.toml.
|
||||
/// > In case it's `actix-web` enable the feature `"actix"`, for `spin` enable `"spin"`.
|
||||
|
@ -361,8 +363,9 @@ where
|
|||
#[cfg(feature = "ssr")]
|
||||
{
|
||||
if !readonly {
|
||||
create_isomorphic_effect(move |_| {
|
||||
let value = cookie
|
||||
.with_untracked(|cookie| {
|
||||
.with(|cookie| {
|
||||
cookie.as_ref().map(|cookie| {
|
||||
C::encode(cookie)
|
||||
.map_err(|err| on_error(CodecError::Encode(err)))
|
||||
|
@ -385,6 +388,7 @@ where
|
|||
ssr_set_cookie,
|
||||
)
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue