Header - #103
Conversation
… pages blog and events
…implement hamburguer menu yiyi
| /// Define a constant for the cookie key used to store the theme setting. | ||
| const COOKIE_KEY: &str = "theme"; |
There was a problem hiding this comment.
| /// Define a constant for the cookie key used to store the theme setting. | |
| const COOKIE_KEY: &str = "theme"; | |
| /// Define a constant for the local storage key used to store the theme setting. | |
| const STORAGE_KEY: &str = "theme"; |
Es mejor mediante storage, no tiene sentido enviar esa información en requests
There was a problem hiding this comment.
Estaba configurado previamente con storage, pero como es SSR, la config que enviaba el cliente no matcheaba con el por defecto que generaba el server, entonces entraba eso en conflicto, por ello se realizó este cambio a cookies.
Entraba en conflicto si se cambiaba de tema la primera vez y se volvía a abrir la web
There was a problem hiding this comment.
There was a problem hiding this comment.
Pero igual el target no es SSR, es CSR, en todo caso lo que podemos hacer es un feature flag para hacer conditional compilation ✨
Eso
There was a problem hiding this comment.
Dejame ver Ted Lasso Mario, espabila que la vida te va a comer
There was a problem hiding this comment.
There was a problem hiding this comment.
Presumiendo el privilegio de mac user
There was a problem hiding this comment.
Pero igual el target no es SSR, es CSR, en todo caso lo que podemos hacer es un feature flag para hacer conditional compilation ✨
Eso
Dime mañana, en tu video no dices nada de eso:
chttps://www.youtube.com/watch?v=wwRleErAWZA
Dislike
There was a problem hiding this comment.
Maldición Mario, tienes razón, y encima no tengo ningún video acerca de conditional compilation (CREO) 😭
| let (theme_storage_state, set_theme_storage_state) = | ||
| use_cookie::<Theme, JsonSerdeCodec>(COOKIE_KEY); |
There was a problem hiding this comment.
| let (theme_storage_state, set_theme_storage_state) = | |
| use_cookie::<Theme, JsonSerdeCodec>(COOKIE_KEY); | |
| let (theme_storage_state, set_theme_storage_state, _) = | |
| use_local_storage::<Theme, JsonSerdeCodec>(STORAGE_KEY); |
| *, | ||
| }; | ||
| use leptos_use::{storage::use_local_storage, use_media_query}; | ||
| use leptos_use::{use_cookie, use_media_query}; |
There was a problem hiding this comment.
| use leptos_use::{use_cookie, use_media_query}; | |
| use leptos_use::{storage::use_local_storage, use_media_query}; |

Result
2026-08-20.01-40-37.mp4