Skip to content

Commit 52d0ae3

Browse files
committed
fix(mobile): replace picker with chooser so the draft survives
1 parent b8da2af commit 52d0ae3

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

‎apps/mobile/src/features/threads/NewTaskContextPickerScreens.tsx‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
squashAtomCommandFailure,
2020
} from "@t3tools/client-runtime/state/runtime";
2121
import * as Haptics from "expo-haptics";
22-
import { useNavigation, type StaticScreenProps } from "@react-navigation/native";
22+
import { StackActions, useNavigation, type StaticScreenProps } from "@react-navigation/native";
2323
import { useRef, useState, type ReactNode } from "react";
2424
import { sanitizeNewRefName } from "@t3tools/shared/git";
2525
import { Platform, Pressable, ScrollView, View } from "react-native";
@@ -225,12 +225,16 @@ export function NewTaskEnvironmentPickerRouteScreen({
225225
onPress={() => {
226226
void Haptics.selectionAsync();
227227
// No silent retarget: a machine without this project goes
228-
// to the project picker for an explicit choice.
228+
// to the project picker for an explicit choice. Replace
229+
// (not push) so the draft stays underneath and setProject
230+
// carries the prompt and attachments over.
229231
if (!flow.canSwitchEnvironmentDirectly(environment.environmentId)) {
230232
if (shareId === undefined) {
231-
navigation.navigate("NewTaskProject");
233+
navigation.dispatch(StackActions.replace("NewTaskProject"));
232234
} else {
233-
navigation.navigate("NewTaskProject", { incomingShareId: shareId });
235+
navigation.dispatch(
236+
StackActions.replace("NewTaskProject", { incomingShareId: shareId }),
237+
);
234238
}
235239
return;
236240
}

0 commit comments

Comments
 (0)