epicweb-dev / epic-stack

This is a Full Stack app starter with the foundational things setup and configured for you to hit the ground running on your next EPIC idea.
https://www.epicweb.dev/epic-stack
MIT License
4.32k stars 355 forks source link

ThemeSwitcher form submit before js loads causing json in browser response #762

Closed marcob896 closed 2 months ago

marcob896 commented 2 months ago

Hi, the theme switcher feature behaviour is not safe with js disabled. If I'm fast enough to click on the toggle before remix takes over the form, I have a "json in browser" response. I think this should be handled conditionally and, if the post comes natively from the browser, the action in app/routes/resources+/theme-switch.tsx should just redirect to request.url, but I don't have the skills to do that myself...

andrecasal commented 1 month ago

Nice catch @marcob896, I've noticed this myself!

Thanks @kentcdodds for the fix ♥️