Skip to content

Header - #103

Merged
Phosphorus-M merged 15 commits into
RustLangES:shared-componentsfrom
MarioYellowy:header
Aug 25, 2026
Merged

Header#103
Phosphorus-M merged 15 commits into
RustLangES:shared-componentsfrom
MarioYellowy:header

Conversation

@MarioYellowy

@MarioYellowy MarioYellowy commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Result

2026-08-20.01-40-37.mp4

@MarioYellowy
MarioYellowy marked this pull request as ready for review August 20, 2026 07:39
Comment thread src/components/header.rs Outdated
Comment thread src/components/header.rs Outdated
Comment thread src/components/header.rs
Comment thread src/context/theme_provider.rs Outdated
Comment thread src/context/theme_provider.rs Outdated
Comment thread src/context/theme_provider.rs Outdated
Comment thread src/context/theme_provider.rs Outdated
Comment on lines +46 to +47
/// Define a constant for the cookie key used to store the theme setting.
const COOKIE_KEY: &str = "theme";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// 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

@MarioYellowy MarioYellowy Aug 24, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dejame ver Ted Lasso Mario, espabila que la vida te va a comer

@Phosphorus-M Phosphorus-M Aug 24, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Como puedes hacer eso?

if cfg!(feature = "ssr") {
    // ...
}

o como

#[cfg(feature = "ssr")]
use holy::shit::omg;

de esa forma ese código solo es valido si la feature flag ssr esta habilitada, tal vez deba ser otra feature flag, no recuerdo las que había en el cargo.toml pero eso ✨

image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumiendo el privilegio de mac user

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sactamente 🙏

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maldición Mario, tienes razón, y encima no tengo ningún video acerca de conditional compilation (CREO) 😭

Comment on lines +111 to +112
let (theme_storage_state, set_theme_storage_state) =
use_cookie::<Theme, JsonSerdeCodec>(COOKIE_KEY);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
use leptos_use::{use_cookie, use_media_query};
use leptos_use::{storage::use_local_storage, use_media_query};

@Phosphorus-M
Phosphorus-M merged commit 745114b into RustLangES:shared-components Aug 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants