Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

failure handling

+23 -8
+23 -8
src/view/com/composer/Composer.tsx
··· 112 112 import {type Gif} from '#/state/queries/tenor' 113 113 import {useAgent, useSession, useSessionApi} from '#/state/session' 114 114 import {useComposerControls} from '#/state/shell/composer' 115 + import {useLoggedOutViewControls} from '#/state/shell/logged-out' 115 116 import {type ComposerOpts, type OnPostSuccessData} from '#/state/shell/composer' 116 117 import {CharProgress} from '#/view/com/composer/char-progress/CharProgress' 117 118 import {ComposerReplyTo} from '#/view/com/composer/ComposerReplyTo' ··· 222 223 const [activeAccountDid, setActiveAccountDid] = useState<string>(currentDid) 223 224 224 225 const {closeComposer} = useComposerControls() 226 + const {requestSwitchToAccount} = useLoggedOutViewControls() 225 227 const {t: l, i18n} = useLingui() 226 228 const requireAltTextEnabled = useRequireAltTextEnabled() 227 229 const omitViaField = useOmitViaField() ··· 911 913 912 914 let currentAgent = agent 913 915 let ephemeralAgent: BskyAgent | undefined 914 - if (activeAccountDid && activeAccountDid !== currentAccount?.did) { 915 - const activeAccount = accounts.find(a => a.did === activeAccountDid) 916 - if (activeAccount) { 917 - ephemeralAgent = await sessionApi.createEphemeralAgent(activeAccount) 918 - currentAgent = ephemeralAgent 919 - } 920 - } 921 - 922 916 let postUri: string | undefined 923 917 let postSuccessData: OnPostSuccessData 924 918 try { 919 + if (activeAccountDid && activeAccountDid !== currentAccount?.did) { 920 + const activeAccount = accounts.find(a => a.did === activeAccountDid) 921 + if (activeAccount) { 922 + try { 923 + ephemeralAgent = await sessionApi.createEphemeralAgent(activeAccount) 924 + currentAgent = ephemeralAgent 925 + } catch (e) { 926 + logger.error('Composer: failed to create ephemeral agent for account switch', { 927 + message: e instanceof Error ? e.message : String(e), 928 + }) 929 + setIsPublishing(false) 930 + requestSwitchToAccount({requestedAccount: activeAccount.did}) 931 + Toast.show(l`Please sign in as @${activeAccount.handle} to post as them`, { 932 + type: 'warning', 933 + }) 934 + return 935 + } 936 + } 937 + } 938 + 925 939 logger.info(`composer: posting...`) 926 940 postUri = ( 927 941 await apilib.post( ··· 1132 1146 activeAccountDid, 1133 1147 currentAccount?.did, 1134 1148 sessionApi, 1149 + requestSwitchToAccount, 1135 1150 ]) 1136 1151 1137 1152 const handleConfirmSkipEmpty = () => {