File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -696,6 +696,9 @@ class EnvironmentVariables:
696696 # How long to delay writing updated states to disk. (Higher values mean less writes, but more chance of lost data.)
697697 REFLEX_STATE_MANAGER_DISK_DEBOUNCE_SECONDS : EnvVar [float ] = env_var (2.0 )
698698
699+ # How long to wait between automatic reload on frontend error to avoid reload loops.
700+ REFLEX_AUTO_RELOAD_COOLDOWN_TIME_MS : EnvVar [int ] = env_var (10_000 )
701+
699702
700703environment = EnvironmentVariables ()
701704
Original file line number Diff line number Diff line change @@ -2487,8 +2487,6 @@ class FrontendEventExceptionState(State):
24872487 re .compile (re .escape ("TypeError: null is not an object" )), # Safari
24882488 re .compile (r"TypeError: can't access property \".*\" of null" ), # Firefox
24892489 ]
2490- # Reload the page only once per cooldown period to avoid reload loops.
2491- auto_reload_cooldown_time_ms : ClassVar [int ] = 10000 # 10 seconds
24922490
24932491 @event
24942492 def handle_frontend_exception (
@@ -2512,10 +2510,10 @@ def handle_frontend_exception(
25122510 ):
25132511 yield call_script (
25142512 f"const last_reload = parseInt(window.sessionStorage.getItem('{ LAST_RELOADED_KEY } ')) || 0;"
2515- f"if (Date.now() - last_reload > { type ( self ). auto_reload_cooldown_time_ms } )"
2513+ f"if (Date.now() - last_reload > { environment . REFLEX_AUTO_RELOAD_COOLDOWN_TIME_MS . get () } )"
25162514 "{"
25172515 f"window.sessionStorage.setItem('{ LAST_RELOADED_KEY } ', Date.now().toString());"
2518- "window.location.reload(true );"
2516+ "window.location.reload();"
25192517 "}"
25202518 )
25212519 prerequisites .get_and_validate_app ().app .frontend_exception_handler (
You can’t perform that action at this time.
0 commit comments