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
{{ message }}
Repository navigation
Several sync=True storage vars sharing one name only sync the last one across tabs #7506
Severity: LOW, pre-existing. main behaves the same before and after #7505.
When two or more rx.LocalStorage(..., sync=True) vars share a storage name, a write in another tab updates only one of them. The common case is a named synced field on an rx.ComponentState used more than once: every instance gets its own substate and state key, but they all share the same storage name. The other vars keep their old value until the page is reloaded.
Cause. In packages/reflex-base/src/reflex_base/.templates/web/utils/state.js, useEventLoop's localStorage effect maps each storage name to a single state key:
So the last synced state key registered for a name wins. handleStorage then sends update_vars_internal for that one var only.
Fix. Map each storage name to every synced state key that uses it. Then send one update_vars_internal whose vars holds all of them, each set to localStorage.getItem(e.key).
Scope. Found by code reading while reviewing #7505 (a Greptile thread there). It has not been reproduced in a browser yet. A regression test can follow the synthetic-StorageEvent pattern of tests/integration/tests_playwright/test_hydration_storage.py from #7505, using two states that declare a synced var under the same name.
Related docs caveat, finding A3-03: a named storage var's key is shared by every ComponentState instance.
Activity
linear-code commentedon Oct 8, 2026
ENG-13208
prerelease 10-07 a3: follow-ups filed (#7506-#7511, enterprise#275, E…