Skip to content
Source
Sign inSign up
pingdotgg/t3code

refactor(web): move the thread's linked pull request out of ChatView #20308

Mergedjuliusmarmingemerged 1 commit intochatview-split/queue fromrefs/pull/20308/headmerged by juliusmarminge View on GitHub

Showing 3 changed files with 111 additions and 0 deletions (loading 2).

x
0 of 3 viewed, 3 left
111 additions and 0 deletionsapps/web/src/components/pullRequest/useThreadLinkedPullRequest.tsAdded
View file
@@ -0,0 +1,111 @@
+import {
+ type EnvironmentId,
+ type ProjectId,
+ type ScopedThreadRef,
+ type ThreadLinkedPullRequest,
+ type VcsStatusResult,
+} from "@t3tools/contracts";
+import { scopedThreadKey } from "@t3tools/client-runtime/environment";
+import {
+ isAtomCommandInterrupted,
+ squashAtomCommandFailure,
+} from "@t3tools/client-runtime/state/runtime";
+import { useEffect, useRef } from "react";
+import { selectActiveRightPanelSurface, useRightPanelStore } from "../../rightPanelStore";
+import { threadEnvironment } from "../../state/threads";
+import { useOrchestrationCommand } from "../../state/use-orchestration-command";
+import { useLinkedThreadPullRequest } from "../ThreadStatusIndicators";
+import { stackedThreadToast, toastManager } from "../ui/toast";
+​
+/**
+ * The change request a thread is linked to. When the linked one is merged or
+ * closed and the thread's branch has a newer open one, that one replaces it:
+ * the thread is relinked on the server, and an open panel showing the old one
+ * follows.
+ */
+export function useThreadLinkedPullRequest(input: {
+ // Null for drafts, which have nothing to relink on the server.
+ readonly serverThreadRef: ScopedThreadRef | null;
+ readonly environmentId: EnvironmentId | null;
+ readonly persisted: ThreadLinkedPullRequest | null;