Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(mobile): opening a new thread before it is created no longer marks it unavailable #25632

Mergedwhoisaldo(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/25632/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Showing 2 changed files with 127 additions and 0 deletions.

x
0 of 2 viewed, 2 left
110 additions and 0 deletionsapps/mobile/src/state/threads.test.tsAdded
View file
@@ -0,0 +1,110 @@
+import {
+ CommandId,
+ EnvironmentId,
+ MessageId,
+ ProjectId,
+ ProviderInstanceId,
+ ThreadId,
+} from "@t3tools/contracts";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vite-plus/test";
+​
+import { appAtomRegistry } from "./atom-registry";
+import { pendingThreadCreationOutcomesAtom } from "./pending-thread-creation";
+import { threadOutboxManager } from "./thread-outbox";
+import type { QueuedThreadMessage } from "./thread-outbox-model";
+import { startOpeningEnvironmentThread } from "./threads";
+​
+const loads = vi.hoisted(() => [] as string[]);
+​
+vi.mock("../connection/runtime", () => ({ connectionAtomRuntime: {} }));
+vi.mock("../connection/catalog", () => ({ environmentCatalog: {} }));
+vi.mock("./shell", () => ({ environmentShell: {} }));
+vi.mock("@t3tools/client-runtime/state/threads", async (importOriginal) => {
+ const { Atom } = await import("effect/reactivity");
+ const stateAtom = Atom.family((key: string) =>
+ Atom.make(() => {
+ loads.push(key);
+ return null;
+ }),
+ );
+ return {