Bluesky app fork with some witchin' additions 💫 witchsky.app
bluesky fork

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

Changed files
-9
src
-9
src/lib/hooks/useAccountSwitcher.ts
··· 3 3 import {useLingui} from '@lingui/react' 4 4 5 5 import {logger} from '#/logger' 6 - import {isWeb} from '#/platform/detection' 7 6 import {type SessionAccount, useSessionApi} from '#/state/session' 8 7 import {useLoggedOutViewControls} from '#/state/shell/logged-out' 9 8 import * as Toast from '#/view/com/util/Toast' ··· 28 27 try { 29 28 setPendingDid(account.did) 30 29 if (account.accessJwt) { 31 - if (isWeb) { 32 - // We're switching accounts, which remounts the entire app. 33 - // On mobile, this gets us Home, but on the web we also need reset the URL. 34 - // We can't change the URL via a navigate() call because the navigator 35 - // itself is about to unmount, and it calls pushState() too late. 36 - // So we change the URL ourselves. The navigator will pick it up on remount. 37 - history.pushState(null, '', '/') 38 - } 39 30 await resumeSession(account, true) 40 31 logEvent('account:loggedIn', {logContext, withPassword: false}) 41 32 Toast.show(_(msg`Signed in as @${account.handle}`))