Skip to content

Commit dd373a8

Browse files
fix(client): keep handoff actions compatible with React Compiler
1 parent f921b9b commit dd373a8

4 files changed

Lines changed: 12 additions & 7 deletions

File tree

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function Notice({ thread }: { thread: EnvironmentThreadShell }) {
5959
working.current = true;
6060
setBusy(true);
6161
setError(null);
62-
try {
62+
const run = async () => {
6363
const result =
6464
action === "retry"
6565
? await threadHandoffEnvironment.start.run(appAtomRegistry, {
@@ -87,12 +87,13 @@ function Notice({ thread }: { thread: EnvironmentThreadShell }) {
8787
failure instanceof Error ? failure.message : "Could not update the move. Try again.",
8888
);
8989
}
90-
} finally {
90+
};
91+
await run().finally(() => {
9192
if (alive.current) {
9293
working.current = false;
9394
setBusy(false);
9495
}
95-
}
96+
});
9697
};
9798
const abandon = () =>
9899
Dialog.confirm({

‎apps/mobile/src/state/thread-task-permissions.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ vi.mock("./use-atom-command", () => ({ useAtomCommand: <A>(command: A) => comman
8686
vi.mock("./threads", async () => {
8787
const { Atom } = await import("effect/reactivity");
8888
return {
89+
environmentThreadShells: { threadShellsAtom: Atom.make([state.thread]) },
8990
environmentThreadDetails: { queueWorkflowAtom: () => Atom.make(null) },
9091
threadEnvironment: {
9192
respondToApproval: state.approve,

‎apps/web/src/components/CommandPalette.focus.browser.test.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ vi.mock("../hooks/useScratchProject", () => ({
3333
useScratchProject: () => ({ scratchEnvironmentId: () => null }),
3434
}));
3535
vi.mock("../hooks/useNewProject", () => ({ useNewProject: () => vi.fn() }));
36-
vi.mock("../hooks/useHandleNewThread", () => ({ useHandleNewThread: () => ({}) }));
36+
vi.mock("../hooks/useHandleNewThread", () => ({
37+
useHandleNewThread: () => ({ activeThread: null }),
38+
}));
3739
vi.mock("../hooks/useOpenPanelPullRequestUrl", () => ({ useOpenPanelPullRequestUrl: () => null }));
3840
vi.mock("../connection/useDesktopLocalBootstraps", () => ({ useDesktopLocalBootstraps: () => [] }));
3941
vi.mock("../state/use-atom-command", () => ({ useAtomCommand: () => vi.fn() }));

‎apps/web/src/components/ThreadHandoffBanner.tsx‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function Notice({ thread }: { thread: EnvironmentThreadShell }) {
5454
working.current = true;
5555
setBusy(true);
5656
setError(null);
57-
try {
57+
const run = async () => {
5858
if (action === "abandon") {
5959
const confirmed = await readLocalApi()?.dialogs.confirm(
6060
"The move outcome is unknown. The destination may already have a copy or finish accepting it later. Continue working here anyway?",
@@ -92,12 +92,13 @@ function Notice({ thread }: { thread: EnvironmentThreadShell }) {
9292
failure instanceof Error ? failure.message : "Could not update the move. Try again.",
9393
);
9494
}
95-
} finally {
95+
};
96+
await run().finally(() => {
9697
if (alive.current) {
9798
working.current = false;
9899
setBusy(false);
99100
}
100-
}
101+
});
101102
};
102103
return (
103104
<div

0 commit comments

Comments
 (0)