Skip to content

Commit e2e9b4d

Browse files
authored
fix(mobile): dev pairing link no longer opens Home inside a sheet (#20130)
1 parent 3ba883e commit e2e9b4d

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎apps/mobile/src/features/connection/ConnectionsNewRouteScreen.tsx‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export function ConnectionsNewRouteScreen({
155155
);
156156

157157
const connectAndClose = useCallback(
158-
async (pairingUrl: string, replaceWithHome: boolean) => {
158+
async (pairingUrl: string) => {
159159
setIsSubmitting(true);
160160
onChangeConnectionPairingUrl(pairingUrl);
161161
try {
@@ -166,7 +166,9 @@ export function ConnectionsNewRouteScreen({
166166
: Haptics.NotificationFeedbackType.Error,
167167
);
168168
if (AsyncResult.isSuccess(result)) {
169-
if (replaceWithHome || !navigation.canGoBack()) {
169+
// Return to whatever opened the sheet. Replacing it with Home would
170+
// nest Home inside any sheet still below it.
171+
if (!navigation.canGoBack()) {
170172
navigation.dispatch(StackActions.replace("Home"));
171173
} else {
172174
navigation.goBack();
@@ -180,7 +182,7 @@ export function ConnectionsNewRouteScreen({
180182
);
181183

182184
const handleSubmit = useCallback(async () => {
183-
await connectAndClose(buildPairingUrl(hostInput, codeInput), false);
185+
await connectAndClose(buildPairingUrl(hostInput, codeInput));
184186
}, [codeInput, connectAndClose, hostInput]);
185187

186188
useEffect(() => {
@@ -189,7 +191,7 @@ export function ConnectionsNewRouteScreen({
189191
}
190192

191193
attemptedAutoConnectRef.current = routePairingUrl;
192-
void connectAndClose(routePairingUrl, true);
194+
void connectAndClose(routePairingUrl);
193195
}, [connectAndClose, routePairingUrl, shouldAutoConnect]);
194196

195197
return (

0 commit comments

Comments
 (0)