W
Wasp3mo ago
NEROX

flash change theme at reload

When I navigate with the wasp routes to a page that doesn't have the DarkModeSwitcher it displays the proper theme but if I reload it, as it doesn't have the DarkModeSwitcher, it turns always white.
2 Replies
kapa.ai
kapa.ai3mo ago
Hi @NEROX. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the information provided in the knowledge sources, I don't have enough specific details to directly address your issue with the DarkModeSwitcher and theme persistence across page reloads in Wasp. However, I can provide some general insights related to theming and styling in Wasp that might be helpful: 1. Wasp uses Tailwind CSS for styling, which includes built-in dark mode support. You might want to check if you're properly implementing Tailwind's dark mode functionality as mentioned in this comment (https://github.com/wasp-lang/wasp/issues/1181#issuecomment-1534486708). 2. There have been issues reported with styling and theming in Wasp, particularly related to dark mode. For example, this GitHub issue (https://github.com/wasp-lang/wasp/issues/1424) discusses making sure visualizations work correctly in dark mode. 3. If you're using custom CSS, make sure it's properly imported in your components. As noted in this GitHub comment (https://github.com/wasp-lang/wasp/issues/1249#issuecomment-1536056458), forgetting to import CSS files can cause styling issues. 4. Wasp's hot reloading functionality might be interfering with your theme state. There have been discussions about calming down the frequent reloads (https://discord.com/channels/686873244791210014/1223304305206099969) which can reset local state. To properly address your specific issue, you might need to look into how you're managing the theme state across your application, ensuring it persists between route changes and page reloads. Consider using a global state management solution or leveraging browser storage (like localStorage) to maintain the theme preference. If the problem persists, you might want to reach out to the Wasp community or open an issue on their GitHub repository with a minimal reproducible example of your setup. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @NEROX, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
NEROX
NEROXOP3mo ago
Solved just added the switch and the page looks cool
No description

Did you find this page helpful?