fix(android): redirect to root on logout to dodge Capacitor SPA-fallback failure on URL-encoded path segments

This commit is contained in:
heaven 2026-05-09 15:07:35 +03:00
parent efe58dc2e2
commit 075b6cf69c

View file

@ -102,7 +102,13 @@ export const logoutClient = async (mx: MatrixClient) => {
}
await mx.clearStores();
window.localStorage.clear();
window.location.reload();
// Navigate to root instead of reload(): on Android Capacitor the
// WebViewLocalServer fails to SPA-fallback on URLs with `%3A` in path
// segments (Matrix room/space ids), so reload of `/<spaceId>/<roomId>/`
// or `/channels/<spaceId>/...` returns ERR_HTTP_RESPONSE_CODE_FAILURE.
// Replacing to `/` always resolves to index.html; the Router index
// loader then redirects to the login page since the session is gone.
window.location.replace('/');
};
export const clearLoginData = async () => {