Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions apps/web/src/components/ChatView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4406,14 +4406,28 @@ function ChatViewContent(props: ChatViewProps) {
linkedPullRequest: linkedThreadPullRequest,
linkedPullRequestStatus,
});
// The right panel offers the thread's own change request, so it can only offer it once the
// branch has one; until then the picker says so rather than opening an empty panel.
// The right panel offers the thread's own change request, else the checkout's open one: the
// same one the git menu's "View PR" opens in this panel. A shared checkout keeps the recorded
// thread branch strict (#4460), so an agent that branches and opens a PR mid-thread leaves the
// thread without one while the checkout has it. A linked PR is the thread's own even while
// its detail is still loading, so the checkout never stands in for it. Without either the
// picker says so rather than opening an empty panel.
const checkoutPr =
linkedThreadPullRequest === null && gitStatusQuery.data?.pr?.state === "open"
? gitStatusQuery.data.pr
: null;
const addPullRequestSurface = useCallback(() => {
if (activeThreadPr === null) return;
openThreadPullRequest(activeThreadPr.number);
}, [activeThreadPr, openThreadPullRequest]);
if (activeThreadPr !== null) {
openThreadPullRequest(activeThreadPr.number);
} else if (checkoutPr !== null) {
openProjectPullRequest(checkoutPr.number);
}
}, [activeThreadPr, checkoutPr, openProjectPullRequest, openThreadPullRequest]);
const pullRequestSurfaceAvailable =
supportsPullRequests && activeThreadPr !== null && threadRepository !== null;
supportsPullRequests &&
(activeThreadPr !== null
? threadRepository !== null
: checkoutPr !== null && activeProjectRepository !== null);
Comment thread
cursor[bot] marked this conversation as resolved.
// Primitive slice of the displayed PR for the settle-rule memos below:
// resolveDisplayedThreadPr returns a fresh object every render, so memoize
// on the fields the rules read instead of the object identity.
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/RightPanelTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const SURFACE_DISABLED_REASONS = {
terminal: "Terminal surfaces are only available from a project thread.",
files: "Files are only available when a project is open.",
diff: "Diff is only available for server threads in Git repositories.",
pullRequest: "This thread's branch has no pull request yet.",
pullRequest: "This branch has no pull request yet.",
agents: "Agents are only available from a thread.",
} as const;

Expand Down
Loading