The best way to control Claude Code, Codex and more from any computer or phone
fix(mobile): prevent crash on sign out in settings (#4899)
shubhu committed
Aug 15, 2026 at 17:57 UTC
277a7cb4458257e950b7962f67c8fafd8d0e31ab
1 file changed
+12
-2
apps/mobile/src/features/settings/SettingsAuthRouteScreen.tsx
+12
-2
@@ -1,7 +1,7 @@
1
import { useAuth } from "@clerk/expo";
2
import { AuthView, UserProfileView } from "@clerk/expo/native";
3
import { StackActions, useNavigation } from "@react-navigation/native";
4
-import { useCallback, useLayoutEffect } from "react";
4
+import { useCallback, useEffect, useLayoutEffect, useRef } from "react";
5
import { View } from "react-native";
6
7
import { hasCloudPublicConfig } from "../cloud/publicConfig";
@@ -25,11 +25,21 @@ function ConfiguredSettingsAuthRouteScreen() {
25
() => navigation.dispatch(StackActions.popTo("SettingsContent")),
26
[navigation],
27
);
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]);
38
39
return (
40
<View collapsable={false} className="flex-1 overflow-hidden bg-sheet">
41
{isLoaded ? (
32
- isSignedIn ? (
42
+ hasBeenSignedIn.current ? (
43
<UserProfileView isDismissible={false} onHostBack={handleHostBack} />
44
) : (
45
<AuthView isDismissible={false} onHostBack={handleHostBack} />