Skip to content

Commit f12a322

Browse files
committed
prerelease 10-07 a3: #7505 lean no-bookkeeping variant measured (storms return)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SjCrbdguMkfe4bhbaREiwo
1 parent 5c466e0 commit f12a322

3 files changed

Lines changed: 42 additions & 0 deletions

File tree

‎prerelease_testing/2026-10-07-a3/a3_hydration/pr7505/NOTES.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,12 @@ Final commit d03ddb107 (`results/d03ddb107/`):
4343
Plus: `test_hydration_storage.py` 22/22 (dev+prod), Selenium client_storage/upload/connection_banner/call_script 23/23, state.js
4444
unit test, pre-commit. Rerun as above after `rm -rf` of the `.web` dirs in `stamp-fix`, `run-fix` and `vh-fix-dev` (template
4545
changes only reach `.web` on a reflex version change).
46+
47+
## Lean variant tried at the maintainer's request (10-08): no echo bookkeeping
48+
49+
`results/lean_variant.diff` on top of main: the storage event sends `localStorage.getItem` and dispatches it locally, every
50+
echo is still written. Result: it does **not** stop the loop. PR Playwright tests: `keeps_newer_value` ping-pongs in prod
51+
(`old, new, old, new, …` writes) and ends on the older value in dev. Storm matrix (`results/lean_variant_matrix.txt`): explorer storm
52+
1/3 runs stormed (~3.5k storage events per tab, tabs split s3/s2); `/stamp 6` 2/3 stormed (32–36k frames per 5 s), the third
53+
converged after 1,737 frames (PR: ~100). Writing a stale echo flips storage and the other tab answers that flip, so a frontend
54+
fix has to recognise and skip stale echoes, which needs a record of the values sent.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
diff --git a/packages/reflex-base/src/reflex_base/.templates/web/utils/state.js b/packages/reflex-base/src/reflex_base/.templates/web/utils/state.js
2+
index 6916df563..64f3ae597 100644
3+
--- a/packages/reflex-base/src/reflex_base/.templates/web/utils/state.js
4+
+++ b/packages/reflex-base/src/reflex_base/.templates/web/utils/state.js
5+
@@ -1265,9 +1265,19 @@ export const useEventLoop = (
6+
7+
// e is StorageEvent
8+
const handleStorage = (e) => {
9+
- if (storage_to_state_map[e.key]) {
10+
- const vars = {};
11+
- vars[storage_to_state_map[e.key]] = e.newValue;
12+
+ // Session storage changes in same-origin frames raise storage events too.
13+
+ const state_key = storage_to_state_map[e.key];
14+
+ if (e.storageArea === localStorage && state_key) {
15+
+ // A tab gets the events of other tabs' writes after its own newer
16+
+ // write too, so use the value stored now rather than e.newValue.
17+
+ const value = localStorage.getItem(e.key);
18+
+ // Show it right away; the backend applies it for handlers and
19+
+ // computed vars.
20+
+ const dot = state_key.lastIndexOf(".");
21+
+ dispatch[state_key.slice(0, dot)]?.({
22+
+ [state_key.slice(dot + 1)]: value,
23+
+ });
24+
+ const vars = { [state_key]: value };
25+
const event = ReflexEvent(
26+
`${app.state_name}.reflex___state____update_vars_internal_state.update_vars_internal`,
27+
{ vars: vars },
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
S: {"observe_windows_5s": [], "finals": {"t0": "s5", "t1": "s5", "t2": "s5", "t3": "s5", "t4": "s5", "t5": "s5", "t6": "s5"}, "ls_final": "s5", "storage_events_per_tab": {"t0": 0, "t1": 5, "t2": 5, "t3": 5, "t4": 5, "t5": 5, "t6": 5}, "uvi_per_tab": {"t0": 0, "t1": 3, "t2": 2, "t3": 2, "t4": 2, "t5": 2, "t6": 3}, "frames_total": 75, "frames_in_quiet_2s": 0, "converged": true}
2+
S: {"observe_windows_5s": [], "finals": {"t0": "s5", "t1": "s5", "t2": "s5", "t3": "s5", "t4": "s5", "t5": "s5", "t6": "s5"}, "ls_final": "s5", "storage_events_per_tab": {"t0": 0, "t1": 5, "t2": 5, "t3": 5, "t4": 5, "t5": 5, "t6": 5}, "uvi_per_tab": {"t0": 0, "t1": 3, "t2": 2, "t3": 3, "t4": 2, "t5": 2, "t6": 2}, "frames_total": 75, "frames_in_quiet_2s": 0, "converged": true}
3+
S: {"observe_windows_5s": [], "finals": {"t0": "s3", "t1": "s3", "t2": "s3", "t3": "s3", "t4": "s3", "t5": "s2", "t6": "s2"}, "ls_final": "s3", "storage_events_per_tab": {"t0": 3495, "t1": 3558, "t2": 3340, "t3": 3520, "t4": 3392, "t5": 3384, "t6": 3319}, "uvi_per_tab": {"t0": 3505, "t1": 3558, "t2": 3340, "t3": 3520, "t4": 3390, "t5": 3382, "t6": 3317}, "frames_total": 36094, "frames_in_quiet_2s"
4+
fix dev n=6 run 1: {"path": "/stamp", "n": 6, "converged": true, "storm": false, "windows_5s": [0, 0], "frames_total": 1737, "finals": ["c000d6-1", "c000d6-1", "c000d6-1", "c000d6-1", "c000d6-1", "c000d6-1"], "storage_events": [152, 142, 146, 160, 126, 129]}
5+
fix dev n=6 run 2: {"path": "/stamp", "n": 6, "converged": false, "storm": true, "windows_5s": [32173, 34522], "frames_total": 89576, "finals": ["2a8100-1", "81ba59-1", "81ba59-1", "2a8100-1", "81ba59-1", "81ba59-1"], "storage_events": [9465, 9557, 9233, 9138, 9453, 8344]}
6+
fix dev n=6 run 3: {"path": "/stamp", "n": 6, "converged": false, "storm": true, "windows_5s": [36374, 36695], "frames_total": 102587, "finals": ["7a23f9-1", "7a23f9-1", "852b51-1", "7a23f9-1", "7a23f9-1", "7a23f9-1"], "storage_events": [10093, 10380, 9646, 10475, 10665, 8454]}

0 commit comments

Comments
 (0)