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
Commit d3f8ccb
Browse filesBrowse the repository at this point in the historyBrowse files
fix: rehydrate state trees that expire during a background task (#7585)
* fix: rehydrate state trees that expire during a background task
A background task releases the state lock while it runs. If the session
expires in that time, `async with self` gets a recreated tree, and the
delta carries only the handler's changes. The browser keeps the values
of the expired session.
A recreated `rx.State` root has empty `router_data`. A foreground event
already uses this signal to rehydrate. `StateProxy.__aenter__` now uses
the same signal: it restores the router from the event context and runs
`BaseStateEventProcessor._rehydrate`. The hydrate snapshot carries
`is_hydrated=false`, so the browser keeps its client storage.
Closes#7478
* fix: release the state lock when rehydrating an expired tree fails
Mark the proxy mutable before the rehydrate, so a failure or a
cancellation goes through __aexit__ and closes the state manager
context.
* docs: scope the rehydrate news to the loaded state tree
* test: disable oplock when simulating Redis expiry
Oplock keeps the tree cached in the process, so deleting the Redis keys
does not expire it.
* fix: keep a background rehydrate from loading the page the client left
The background task's route is the one it started on. After the tree
expires, the client may be on another page, so the rehydrate stays
routeless and the client's next event loads its current page.
A background task that re-enters an expired session now rehydrates the loaded state tree, so the browser no longer shows stale values for those states.
A background task that re-enters an expired session now rehydrates the loaded states. The browser drops their stale values and keeps its route and browser storage; its next event runs the current page's on_load.
0 commit comments