diff --git a/src/view/com/testing/TestCtrls.e2e.tsx b/src/view/com/testing/TestCtrls.e2e.tsx index 5eda574fdb..f3f7743b7e 100644 --- a/src/view/com/testing/TestCtrls.e2e.tsx +++ b/src/view/com/testing/TestCtrls.e2e.tsx @@ -18,13 +18,25 @@ LogBox.ignoreAllLogs() const BTN = {height: 1, width: 1, backgroundColor: 'red'} +/* + * This component is mounted inside in + * App.tsx, so it fully remounts whenever the account changes (sign-in / + * sign-out). If the "proxy configured" flag lived only in React state it would + * reset to false on every remount, hiding the sign-in buttons. Keeping it at + * module level lets it survive remounts so the sign-in buttons stay visible + * across sign-out during multi-account flows. Module state still resets when + * the app relaunches with cleared state at the start of each flow, which is the + * desired gating behavior. + */ +let hasConfiguredProxy = false + export function TestCtrls() { const agent = useAgent() const queryClient = useQueryClient() const {logoutEveryAccount, login} = useSessionApi() const onboardingDispatch = useOnboardingDispatch() const {setShowLoggedOut} = useLoggedOutViewControls() - const [isProxyConfigured, setIsProxyConfigured] = useState(false) + const [isProxyConfigured, setIsProxyConfigured] = useState(hasConfiguredProxy) const onPressSignInAlice = async () => { console.info('[E2E] Signing in as Alice') await login( @@ -64,6 +76,7 @@ export function TestCtrls() { const header = `${proxyHeader}#bsky_appview` BLUESKY_PROXY_HEADER.set(header) agent.configureProxy(header as any) + hasConfiguredProxy = true setIsProxyConfigured(true) }} style={BTN}