fix(client): preserve prefs on logout; recover from initial-sync failure (N98/N99)
- N98: logoutClient and handleLogout now call removeFallbackSession() (removes only the 4 session credential keys) instead of window.localStorage.clear(), so settings, unsent drafts, PiP position, and status are preserved across a normal logout. localStorage.clear() stays reserved for clearLoginData() (the explicit factory-reset path). - N99: the useSyncState callback now handles ERROR/STOPPED. A sync failure before the first PREPARED (offline at startup, homeserver unreachable) shows a dedicated error splash with a Retry button (startMatrix) instead of an endless "Heating up" spinner alongside a contradictory "Connection Lost!" banner. Guarded by a hasPreparedRef so post-PREPARED transient errors still go through <SyncStatus>; PREPARED self-heals the splash on recovery, and the redundant banner is suppressed while the splash is shown. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@ import { createClient, MatrixClient, IndexedDBStore, IndexedDBCryptoStore } from
|
||||
|
||||
import { cryptoCallbacks } from './secretStorageKeys';
|
||||
import { clearNavToActivePathStore } from '../app/state/navToActivePath';
|
||||
import { removeFallbackSession } from '../app/state/sessions';
|
||||
import { pushSessionToSW } from '../sw-session';
|
||||
|
||||
type Session = {
|
||||
@@ -75,7 +76,9 @@ export const logoutClient = async (mx: MatrixClient) => {
|
||||
// ignore if failed to logout
|
||||
}
|
||||
await mx.clearStores();
|
||||
window.localStorage.clear();
|
||||
// Remove only the session credential keys, preserving user preferences and
|
||||
// unsent drafts (N98). The factory-reset path is clearLoginData() below.
|
||||
removeFallbackSession();
|
||||
window.location.reload();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user