reflex-dev / reflex

🕸️ Web apps in pure Python 🐍
https://reflex.dev
Apache License 2.0
19.24k stars 1.09k forks source link

[REF-2588] Reflex should clear color cookie #3087

Closed Alek99 closed 2 months ago

Alek99 commented 5 months ago

Describe the bug

Right now if you manually edit the cookie in the browser when doing reflex run again the chakra-ui-color-mode cookie does not change.

To Reproduce Steps to reproduce the behavior:

Change the cookie in your browser to light/dark and re run the app where your appearance is the opposite in your rx.theme

Expected behavior A clear and concise description of what you expected to happen.

In development mode should match the appearance prop in the theme

REF-2588

picklelo commented 3 months ago

@Lendemor good point. I think we may need to combine this with the change to maintain state between hot reloads and tie the color mode to the state.

masenf commented 3 months ago

Some prior art https://github.com/reflex-dev/reflex/blob/44ad9a73119b5c028f72bde97f61cd2e8dfdd89f/reflex/components/radix/themes/base.py#L260-L272

But i do actually wonder how necessary this ticket is overall.

Lendemor commented 3 months ago

Ok I actually see why we need it, I think clearing the value set with color_mode.toggle during dev is fine. We currently have "system" as the default, but if dev want to enforce appearance="light" or appearance="dark" they have to open the website in incognito tab, which is simple fix but shouldn't be necessary to dev. Related discord discussion: https://discord.com/channels/1029853095527727165/1252028062757945344