diff --git a/apps/code/src/renderer/App.tsx b/apps/code/src/renderer/App.tsx index 98ec21fbf..15babd5de 100644 --- a/apps/code/src/renderer/App.tsx +++ b/apps/code/src/renderer/App.tsx @@ -116,6 +116,16 @@ function App() { }), ); + useSubscription( + trpcReact.workspace.onLinkedBranchChanged.subscriptionOptions(undefined, { + onData: () => { + void queryClient.invalidateQueries( + trpcReact.workspace.getAll.pathFilter(), + ); + }, + }), + ); + useSubscription( trpcReact.focus.onBranchRenamed.subscriptionOptions(undefined, { onData: ({ worktreePath, newBranch }) => { diff --git a/apps/code/src/renderer/features/git-interaction/hooks/useGitInteraction.ts b/apps/code/src/renderer/features/git-interaction/hooks/useGitInteraction.ts index 04e19dc70..3581f3ffb 100644 --- a/apps/code/src/renderer/features/git-interaction/hooks/useGitInteraction.ts +++ b/apps/code/src/renderer/features/git-interaction/hooks/useGitInteraction.ts @@ -296,6 +296,18 @@ export function useGitInteraction( } if (result.prUrl) { + const linkedBranchName = store.createPrNeedsBranch + ? store.branchName.trim() + : git.currentBranch; + if (linkedBranchName) { + queryClient.setQueryData( + trpc.git.getPrUrlForBranch.queryKey({ + directoryPath: repoPath, + branchName: linkedBranchName, + }), + result.prUrl, + ); + } await trpcClient.os.openExternal.mutate({ url: result.prUrl }); attachPrUrlToTask(taskId, result.prUrl); }