persist e2e proxy-configured flag across account remounts
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -18,13 +18,25 @@ LogBox.ignoreAllLogs()
|
|||||||
|
|
||||||
const BTN = {height: 1, width: 1, backgroundColor: 'red'}
|
const BTN = {height: 1, width: 1, backgroundColor: 'red'}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This component is mounted inside <Fragment key={currentAccount?.did}> 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() {
|
export function TestCtrls() {
|
||||||
const agent = useAgent()
|
const agent = useAgent()
|
||||||
const queryClient = useQueryClient()
|
const queryClient = useQueryClient()
|
||||||
const {logoutEveryAccount, login} = useSessionApi()
|
const {logoutEveryAccount, login} = useSessionApi()
|
||||||
const onboardingDispatch = useOnboardingDispatch()
|
const onboardingDispatch = useOnboardingDispatch()
|
||||||
const {setShowLoggedOut} = useLoggedOutViewControls()
|
const {setShowLoggedOut} = useLoggedOutViewControls()
|
||||||
const [isProxyConfigured, setIsProxyConfigured] = useState(false)
|
const [isProxyConfigured, setIsProxyConfigured] = useState(hasConfiguredProxy)
|
||||||
const onPressSignInAlice = async () => {
|
const onPressSignInAlice = async () => {
|
||||||
console.info('[E2E] Signing in as Alice')
|
console.info('[E2E] Signing in as Alice')
|
||||||
await login(
|
await login(
|
||||||
@@ -64,6 +76,7 @@ export function TestCtrls() {
|
|||||||
const header = `${proxyHeader}#bsky_appview`
|
const header = `${proxyHeader}#bsky_appview`
|
||||||
BLUESKY_PROXY_HEADER.set(header)
|
BLUESKY_PROXY_HEADER.set(header)
|
||||||
agent.configureProxy(header as any)
|
agent.configureProxy(header as any)
|
||||||
|
hasConfiguredProxy = true
|
||||||
setIsProxyConfigured(true)
|
setIsProxyConfigured(true)
|
||||||
}}
|
}}
|
||||||
style={BTN}
|
style={BTN}
|
||||||
|
|||||||
Reference in New Issue
Block a user