Conversation
Dispatch a shared userLoggedOut action on logout and invalid token detection that resets sync slices, cancels active operations, stops pollers, and clears authenticated RTK Query caches.
katinthehatsite
left a comment
There was a problem hiding this comment.
Thanks for making the changes @gcsecsey - nice work!
I found some issues on my end when testing this PR. This is what I saw on my end: I started the pull operation and waited until the downloading backup step. Then, I logged out and noticed that some of the buttons were stuck in the "Importing" state:
(see the top right corner)
Then, when I log in as a different user, I see the following issue on the import screen:
When importSite fails during a sync pull, the pull Redux state stays at 'importing' while the import context fires an error event. Since canCancelPull only allows cancellation for 'in-progress' and 'downloading' states, the user gets stuck with a disabled dismiss button. Add an isError flag to ImportProgressState and set it on import errors. In the sync UI, detect when a pull is in 'importing' state but the import has failed, and treat it as a pull error so the user can dismiss it and retry.
Thanks for the review @katinthehatsite, great catch! This was caused by the import/export also being tracked in the ImportExportProvider context, not just Redux. I set this to also be reset on logout. I also encountered a stuck state when trying to pull a site that caused a db import issue:
I updated the component to treat this state as a pull error as well, to unblock this state. However, I'm not sure if this is the best approach to handle this. I think ideally we'd show the pull operation as completed, and separately also show the db import error in a dialog, similarly to how it's done when importing, right? |
📊 Performance Test ResultsComparing 0d93adc vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |



Related issues
Fixes STU-166
How AI was used in this PR
I used AI to research the existing logout flow, then implemented and iterated on the changes using it.
Proposed Changes
When a user logged out, sync-related Redux state was not cleared, and the stale data remained in memory. If a different user logged in, they could see leftover sync UI state from the previous session.
This PR adds a userLoggedOut Redux action that is dispatched either when logging out explicitly or when an invalid token is detected. Multiple slices and a store listener react to this:
syncOperationsslice resetspullStatesandpushStatesto emptysyncslice clears the remote file tree cacheconnectedSitesslice resets modal and selection stateTesting Instructions
CleanShot.2026-03-04.at.16.41.21.mp4
Pre-merge Checklist