Skip to content

Preserve state on hot reload#3896

Open
T4rk1n wants to merge 1 commit into
devfrom
state-preserving-hot-reload
Open

Preserve state on hot reload#3896
T4rk1n wants to merge 1 commit into
devfrom
state-preserving-hot-reload

Conversation

@T4rk1n

@T4rk1n T4rk1n commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Add dev_tools_hot_reload_preserve_state: keep UI state across hot reloads

When enabled, the renderer records UI-driven prop edits, set_props
updates (clientside, serverside and websocket) and memory-type dcc.Store
writes as [newVal, originalVal] pairs. Just before a hot reload - soft
RELOAD dispatch or full page reload - they are snapshotted (in memory +
sessionStorage), then re-applied to the incoming layout unless a prop's
initial value changed in the reloaded code, in which case the new code
wins. Unmatched edits stay pending so components inserted by callbacks
(e.g. pages content) are restored too. The snapshot is only written when
a hot reload fires and consumed on use, so a manual browser refresh
still resets the app.

Off by default; enable with dev_tools_hot_reload_preserve_state=True or
DASH_HOT_RELOAD_PRESERVE_STATE=true.

…oads

When enabled, the renderer records UI-driven prop edits, set_props
updates (clientside, serverside and websocket) and memory-type dcc.Store
writes as [newVal, originalVal] pairs. Just before a hot reload - soft
RELOAD dispatch or full page reload - they are snapshotted (in memory +
sessionStorage), then re-applied to the incoming layout unless a prop's
initial value changed in the reloaded code, in which case the new code
wins. Unmatched edits stay pending so components inserted by callbacks
(e.g. pages content) are restored too. The snapshot is only written when
a hot reload fires and consumed on use, so a manual browser refresh
still resets the app.

Off by default; enable with dev_tools_hot_reload_preserve_state=True or
DASH_HOT_RELOAD_PRESERVE_STATE=true.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant