Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): clean up worktrees when deleting archived threads #9116

Closedlnieuwenhuis(GitHub profile, opens in a new tab)wants to merge 5 commits intomain fromrefs/pull/9116/headopened View on GitHub

Showing 8 changed files with 133 additions and 13 deletions (loading 6).

x
0 of 8 viewed, 8 left
64 additions and 1 deletionapps/web/src/hooks/useThreadActions.test.tsModified
View file
@@ -1,9 +1,10 @@
-import { EnvironmentId, ThreadId } from "@t3tools/contracts";
+import { EnvironmentId, ThreadId, type ScopedThreadRef } from "@t3tools/contracts";
import { afterEach, describe, expect, it, vi } from "vite-plus/test";
​
import {
navigateAfterThreadDeletion,
requestThreadUnpinConfirmation,
+ resolveThreadDeleteTarget,
ThreadArchiveBlockedError,
} from "./useThreadActions";
import { toastManager } from "../components/ui/toast";
@@ -51,6 +52,68 @@
});
});
​
+describe("resolveThreadDeleteTarget", () => {
+ const target: ScopedThreadRef = {
+ environmentId: EnvironmentId.make("environment-1"),
+ threadId: ThreadId.make("thread-1"),
+ };
+ const activeThread = { id: ThreadId.make("thread-1"), title: "active-thread" };
+ const archivedThread = { id: ThreadId.make("thread-1"), title: "archived-thread" };
+​
+ it("uses the active-store resolution when it hits, without fetching", async () => {
+ const fetchArchived = () => {
+ throw new Error("must not fetch the archived snapshot when the active store hits");
+ };
+ const result = await resolveThreadDeleteTarget({
+ target,