Skip to content

Commit ae995d7

Browse files
fix(mobile): complete project creation in one transition
1 parent ab7a842 commit ae995d7

7 files changed

Lines changed: 13 additions & 54 deletions

File tree

-771 KB
Binary file not shown.
771 KB
Binary file not shown.

‎apps/mobile/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134
"react-native-pdf-jsi": "5.0.0",
135135
"react-native-reanimated": "4.7.1",
136136
"react-native-safe-area-context": "~5.10.1",
137-
"react-native-screens": "file:deps/react-native-screens-5.0.0-t3.44.tgz",
137+
"react-native-screens": "file:deps/react-native-screens-5.0.0-t3.45.tgz",
138138
"react-native-svg": "15.16.0",
139139
"react-native-webview": "14.0.1",
140140
"react-native-worklets": "0.13.0",

‎apps/mobile/src/features/projects/AddProjectScreen.test.ts‎

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import { createRoot } from "react-dom/client";
1414
import { afterEach, beforeEach, describe, expect, it, vi } from "vite-plus/test";
1515

1616
const state = vi.hoisted(() => ({
17-
transitions: new Set<(event: { data: { closing: boolean } }) => void>(),
1817
scopes: new Set<string>(),
1918
baseDirectory: "",
2019
projects: [] as string[],
@@ -75,10 +74,6 @@ vi.mock("react-native", () => ({
7574
vi.mock("@react-navigation/native", () => ({
7675
useNavigation: () => ({
7776
dispatch: state.dispatch,
78-
addListener: (_name: string, listener: (event: { data: { closing: boolean } }) => void) => {
79-
state.transitions.add(listener);
80-
return () => state.transitions.delete(listener);
81-
},
8277
getState: () =>
8378
state.navigationState ?? {
8479
index: 4,
@@ -93,7 +88,6 @@ vi.mock("@react-navigation/native", () => ({
9388
}),
9489
CommonActions: { reset: (input: unknown) => input },
9590
StackActions: {
96-
popToTop: () => ({ type: "POP_TO_TOP" }),
9791
push: (name: string, params: unknown) => ({ type: "PUSH", payload: { name, params } }),
9892
},
9993
}));
@@ -335,9 +329,7 @@ function mountProjectFlow(
335329
state.navigationState = current;
336330
state.dispatch.mockImplementation((action) =>
337331
apply(
338-
action.type === "PUSH" ||
339-
action.type === "POP_TO_TOP" ||
340-
action.type === "SELECT_WORKSPACE_DETAIL"
332+
action.type === "PUSH" || action.type === "SELECT_WORKSPACE_DETAIL"
341333
? action
342334
: CommonActions.reset(action),
343335
),
@@ -503,7 +495,6 @@ describe("add project source environment", () => {
503495

504496
describe("local project navigation", () => {
505497
function setup() {
506-
state.transitions.clear();
507498
state.navigationState = undefined;
508499
state.scopes = new Set([AuthOrchestrationOperateScope]);
509500
state.baseDirectory = "/tmp/t3-mobile-audit-fixture";
@@ -664,21 +655,6 @@ describe("local project navigation", () => {
664655
}
665656
});
666657

667-
it("does not replace a destination opened while the chooser is closing", async () => {
668-
const { created, projected, submit } = setup();
669-
const navigation = mountProjectFlow(false, false, true);
670-
const submission = submit();
671-
created.resolve(AsyncResult.success(undefined));
672-
projected.resolve({ environmentId: "environment", id: "project" });
673-
await submission;
674-
expect(navigation.getState().routes.map((route) => route.name)).toEqual(["Home"]);
675-
navigation.push("PullRequest");
676-
const selected = navigation.getState();
677-
for (const listener of state.transitions) listener({ data: { closing: true } });
678-
expect(navigation.getState()).toBe(selected);
679-
expect(state.transitions.size).toBe(0);
680-
});
681-
682658
it.each([
683659
{ origin: "Thread", withDraft: true, withChooser: true },
684660
{ origin: "NewTaskProject", withDraft: false, withChooser: true },
@@ -696,10 +672,7 @@ describe("local project navigation", () => {
696672
expect(navigation.getState()).toBe(before);
697673
projected.resolve({ environmentId: "environment", id: "project" });
698674
await submission;
699-
if (!withDraft) {
700-
expect(navigation.getState().routes.map((route) => route.name)).toEqual(["Home"]);
701-
for (const listener of state.transitions) listener({ data: { closing: true } });
702-
}
675+
expect(state.dispatch).toHaveBeenCalledTimes(1);
703676
expect(navigation.getState().routes.map((route) => route.name)).toEqual(["Home", "Thread"]);
704677
expect(navigation.getState().routes[1]?.params).toEqual({
705678
draft: {

‎apps/mobile/src/features/projects/AddProjectScreen.tsx‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -689,20 +689,6 @@ function useOpenNewTaskDraft() {
689689
activeRoute.params !== originRoute.params
690690
)
691691
return;
692-
const state = navigation.getState();
693-
if (Platform.OS === "ios" && state && !state.routes.some((route) => route.name === "Thread")) {
694-
const homeKey = state.routes[0]?.key;
695-
// UIKit must finish removing the chooser before a new detail card is inserted.
696-
const unsubscribe = navigation.addListener("transitionEnd", (event) => {
697-
if (!event.data.closing) return;
698-
unsubscribe();
699-
const current = navigation.getState();
700-
if (current?.index !== 0 || current.routes[0]?.key !== homeKey) return;
701-
selectDetail({ name: "Thread", params: { draft: params } });
702-
});
703-
navigation.dispatch(StackActions.popToTop());
704-
return;
705-
}
706692
selectDetail({ name: "Thread", params: { draft: params } });
707693
};
708694
}

‎docs/operations/mobile-screens-fork.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Building the mobile Screens dependency
22

33
The mobile v5 stack uses a committed tarball from the
4-
[T3 Screens fork](https://github.com/pingdotgg/react-native-screens/tree/t3-v5.0.0-t3.44).
4+
[T3 Screens fork](https://github.com/pingdotgg/react-native-screens/tree/t3-v5.0.0-t3.45).
55
The fork owns the integration changes; the app does not patch this package.
66
Each archive includes compiled JavaScript, declarations, native source and
77
`t3-fork.json` recording its version, source commit and upstream base.

‎pnpm-lock.yaml‎

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)