From 7f86c6d31f02972cb0db240ce328d3ef59500b97 Mon Sep 17 00:00:00 2001 From: adam Date: Tue, 16 Dec 2025 09:30:25 +0100 Subject: [PATCH] preserve URL when switching accounts honestly i thought this would at least need a refresh or something but just removing the `pushState` call seems to work fine lol ref http://witchsky.app/profile/adamperkowski.dev/post/3ma2rtsoji22s --- src/lib/hooks/useAccountSwitcher.ts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/lib/hooks/useAccountSwitcher.ts b/src/lib/hooks/useAccountSwitcher.ts index b8fe0280d..5c0485c9f 100644 --- a/src/lib/hooks/useAccountSwitcher.ts +++ b/src/lib/hooks/useAccountSwitcher.ts @@ -3,7 +3,6 @@ import {msg} from '@lingui/macro' import {useLingui} from '@lingui/react' import {logger} from '#/logger' -import {isWeb} from '#/platform/detection' import {type SessionAccount, useSessionApi} from '#/state/session' import {useLoggedOutViewControls} from '#/state/shell/logged-out' import * as Toast from '#/view/com/util/Toast' @@ -28,14 +27,6 @@ export function useAccountSwitcher() { try { setPendingDid(account.did) if (account.accessJwt) { - if (isWeb) { - // We're switching accounts, which remounts the entire app. - // On mobile, this gets us Home, but on the web we also need reset the URL. - // We can't change the URL via a navigate() call because the navigator - // itself is about to unmount, and it calls pushState() too late. - // So we change the URL ourselves. The navigator will pick it up on remount. - history.pushState(null, '', '/') - } await resumeSession(account, true) logEvent('account:loggedIn', {logContext, withPassword: false}) Toast.show(_(msg`Signed in as @${account.handle}`)) -- 2.51.2