Skip to content

fix: synchronize localStorage clear events across tabs - #7652

Open
suryakant-source wants to merge 3 commits into
reflex-dev:mainfrom
suryakant-source:sync-storage-clear
Open

suryakant-source wants to merge 3 commits into
reflex-dev:mainfrom
suryakant-source:sync-storage-clear

Conversation

@suryakant-source

@suryakant-source suryakant-source commented Oct 24, 2026 •

Copy link
Copy Markdown

Closes #7649.

localStorage.clear() sends a storage event with key === null to other tabs. That key never matches the configured storage-name map, so synchronized vars keep their old values in those tabs.

Queue the existing local-storage synchronization event for each configured synced name when the event has no key. Individual-key events still use the existing lookup. Values are still read at send time, shared-name vars stay grouped, and sessionStorage events remain excluded.

Added three actual-module runtime regressions covering clear events with shared names and unsynced vars, sessionStorage clear events, and configurations with no synced vars. Added a reflex-base news fragment. The clear regression fails on the unchanged template (zero updates instead of two).

Validation:

  • Node VM runtime suite: 35 passed.
  • Compiler suite: 331 passed.
  • Package/compiler suites: 1,448 passed, 12 skipped.
  • Other unit suites were run in smaller groups: 800 CLI; 2,819 package tests; 480 release tests; 310 state tests; 7,505 remaining tests passed. The 3 SQLAlchemy tests pass in isolation, but test_automigration fails when grouped with some other root tests, so I am not claiming a clean monolithic run.
  • Initial full run: 13,117 passed, 78 skipped, 248 CLI failures caused by a shallow checkout reporting Reflex as 0.0.1. Fetching full history and reinstalling reports 0.10.1.dev92; all 800 CLI tests then pass.
  • Pre-commit hooks pass on all changed files, including Biome, codespell and ty. Ruff check and format checks pass repo-wide.
  • Full pyright reflex tests could not complete within local memory/time limits. No Python source is changed.

Checked the open PRs and issue timeline for competing work before submission. Reviewed the patch for clear-event fanout, shared-name grouping, storage-area exclusion and no-op configurations.

View guided diff

@suryakant-source
suryakant-source requested a review from a team as a code owner October 24, 2026 02:41

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

View guided diff | Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Fixes cross-tab synchronization when localStorage.clear() sends an event with no key.

  • Clearing localStorage now syncs configured state across tabs.

Reviews (1) · Last reviewed commit: "Create +sync-local-storage-clear.bugfix...." · Reviewed by Greptile

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cross-tab localStorage clears do not synchronize configured state

1 participant