reflex-dev/reflex-examples

clock example: switch ui is not correct after refresh (0.1.32)

milochen0418 opened this issue · 2 comments

My Testing Environment
        OS Darwin 22.4.0
        Pynecone 0.1.32
        Python 3.11.3
        Node v16.8.0
        Bun 0.5.9

Turn switch on and refresh page.
The switch is still on but clock is not moving.
The expected switch on UI is to display switch-off

Screenshot 2023-05-29 at 12 26 21 PM

This is because the event queue gets cleared when the page refreshes... I think we need to use some sort of localStorage potentially to save the event queue if we want to preserve it between refreshes. For now I added an on_load event to always turn the switch off on refreshes.

Note: This issue is solved by the following