You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have reviewed Leptonic's code and now understand what is happening. The Root component sets the theme in ThemeProvider not directly from the default value but from the theme value stored in the browser's local storage.
Initially, I compiled and ran the project before changing the theme to Dark. When I launched the browser, it stored the theme value as Light in its local storage. After changing the theme to Dark and refreshing the browser, the project, which has SSR (Server-Side Rendering) features enabled, rendered the HTML with the default theme value I provided (Dark) on the server side. However, once the WASM (WebAssembly) loaded on the client side, the theme value from the local storage became accessible, changing the theme to Light.
I don't think it will cause any bugs in production environments (no one would change the Root component's default theme). However, I still find the behavior somewhat unnatural. In my opinion, the theme value given to the Root component should remain unchanged until explicitly toggled. I suggest storing the toggle's value in local storage rather than the theme itself. This would alleviate the confusing behavior.
Template setting doesn't work
Rust version: 1.78.0 (stable)
Replication process:
LeptonicTheme::Dark
cargo leptos watch
my app.rs code is the following. nothing changed except theme.
screen-recording-2024-06-13-at-125925-pm_cEYbE4vu.mp4
The text was updated successfully, but these errors were encountered: