Skip to content
TypeScript

fix(mobile): dev pairing link no longer opens Home inside a sheet (#20130)

Alexe2e9b4d3b798
diff --git a/apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx b/apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx
index 4f5398af94a..638116844c1 100644
--- a/apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx
+++ b/apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx
@@ -155,7 +155,7 @@ export function ConnectionsNewRouteScreen({
);
const connectAndClose = useCallback(
- async (pairingUrl: string, replaceWithHome: boolean) => {
+ async (pairingUrl: string) => {
setIsSubmitting(true);
onChangeConnectionPairingUrl(pairingUrl);
try {
@@ -166,7 +166,9 @@ export function ConnectionsNewRouteScreen({
: Haptics.NotificationFeedbackType.Error,
);
if (AsyncResult.isSuccess(result)) {
- if (replaceWithHome || !navigation.canGoBack()) {
+ // Return to whatever opened the sheet. Replacing it with Home would
+ // nest Home inside any sheet still below it.
+ if (!navigation.canGoBack()) {
navigation.dispatch(StackActions.replace("Home"));
} else {
navigation.goBack();
@@ -180,7 +182,7 @@ export function ConnectionsNewRouteScreen({
);
const handleSubmit = useCallback(async () => {
- await connectAndClose(buildPairingUrl(hostInput, codeInput), false);
+ await connectAndClose(buildPairingUrl(hostInput, codeInput));
}, [codeInput, connectAndClose, hostInput]);
useEffect(() => {
@@ -189,7 +191,7 @@ export function ConnectionsNewRouteScreen({
}
attemptedAutoConnectRef.current = routePairingUrl;
- void connectAndClose(routePairingUrl, true);
+ void connectAndClose(routePairingUrl);
}, [connectAndClose, routePairingUrl, shouldAutoConnect]);
return (