authorgravatar for 93861282+shubhu121@users.noreply.github.comshubhu <93861282+shubhu121@users.noreply.github.com> 2026-08-15 17:57:26+05:30
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-08-15 14:27:26+02:00
log277a7cb4458257e950b7962f67c8fafd8d0e31ab
treebcbf803f36eb4f5a817a19a72f3787b06c5f28d5
parent07e668dc48ce58fc9244ceeef62b9af929293a2a
signature Signed by PGP key B5690EEEBB952194

fix(mobile): prevent crash on sign out in settings (#4899)


1 files changed, 12 insertions(+), 2 deletions(-)

apps/mobile/src/features/settings/SettingsAuthRouteScreen.tsx+12-2
......@@ -1,7 +1,7 @@
11import { useAuth } from "@clerk/expo";
22import { AuthView, UserProfileView } from "@clerk/expo/native";
33import { StackActions, useNavigation } from "@react-navigation/native";
4import { useCallback, useLayoutEffect } from "react";
4import { useCallback, useEffect, useLayoutEffect, useRef } from "react";
55import { View } from "react-native";
66
77import { hasCloudPublicConfig } from "../cloud/publicConfig";
......@@ -25,11 +25,21 @@ function ConfiguredSettingsAuthRouteScreen() {
2525 () => navigation.dispatch(StackActions.popTo("SettingsContent")),
2626 [navigation],
2727 );
28 const hasBeenSignedIn = useRef(isSignedIn);
29 if (isSignedIn) {
30 hasBeenSignedIn.current = true;
31 }
32
33 useEffect(() => {
34 if (hasBeenSignedIn.current && isLoaded && isSignedIn === false) {
35 navigation.dispatch(StackActions.popTo("SettingsContent"));
36 }
37 }, [isLoaded, isSignedIn, navigation]);
2838
2939 return (
3040 <View collapsable={false} className="flex-1 overflow-hidden bg-sheet">
3141 {isLoaded ? (
32 isSignedIn ? (
42 hasBeenSignedIn.current ? (
3343 <UserProfileView isDismissible={false} onHostBack={handleHostBack} />
3444 ) : (
3545 <AuthView isDismissible={false} onHostBack={handleHostBack} />