({
worktreePath,
activeTab: controlledActiveTab,
selectedFilePath,
onFileSelect: onFileSelectProp,
onFileOpenPinned,
onCreatePr,
onCommitSuccess,
onDiscardSuccess,
subChats = [],
initialSubChatFilter = null,
chatId,
selectedCommitHash,
onCommitSelect,
onCommitFileSelect,
onActiveTabChange,
pushCount,
}: ChangesViewProps)
| 267 | } |
| 268 | |
| 269 | export function ChangesView({ |
| 270 | worktreePath, |
| 271 | activeTab: controlledActiveTab, |
| 272 | selectedFilePath, |
| 273 | onFileSelect: onFileSelectProp, |
| 274 | onFileOpenPinned, |
| 275 | onCreatePr, |
| 276 | onCommitSuccess, |
| 277 | onDiscardSuccess, |
| 278 | subChats = [], |
| 279 | initialSubChatFilter = null, |
| 280 | chatId, |
| 281 | selectedCommitHash, |
| 282 | onCommitSelect, |
| 283 | onCommitFileSelect, |
| 284 | onActiveTabChange, |
| 285 | pushCount, |
| 286 | }: ChangesViewProps) { |
| 287 | useFileChangeListener(worktreePath); |
| 288 | |
| 289 | // Viewed files state from agents diff view (for showing eye icon and toggling) |
| 290 | const [viewedFiles, setViewedFiles] = useAtom(viewedFilesAtomFamily(chatId || "")); |
| 291 | |
| 292 | const { baseBranch } = useChangesStore(); |
| 293 | const { data: branchData } = trpc.changes.getBranches.useQuery( |
| 294 | { worktreePath: worktreePath || "" }, |
| 295 | { enabled: !!worktreePath }, |
| 296 | ); |
| 297 | |
| 298 | const effectiveBaseBranch = baseBranch ?? branchData?.defaultBranch ?? "main"; |
| 299 | |
| 300 | const { |
| 301 | data: status, |
| 302 | isLoading, |
| 303 | refetch, |
| 304 | } = trpc.changes.getStatus.useQuery( |
| 305 | { worktreePath: worktreePath || "", defaultBranch: effectiveBaseBranch }, |
| 306 | { |
| 307 | enabled: !!worktreePath, |
| 308 | refetchOnWindowFocus: true, |
| 309 | // Use default staleTime (5000ms) - GitWatcher handles real-time invalidation |
| 310 | }, |
| 311 | ); |
| 312 | |
| 313 | const { pr, refetch: refetchPRStatus } = usePRStatus({ |
| 314 | worktreePath, |
| 315 | refetchInterval: 10000, |
| 316 | }); |
| 317 | |
| 318 | const handleRefresh = () => { |
| 319 | refetch(); |
| 320 | refetchPRStatus(); |
| 321 | }; |
| 322 | |
| 323 | // Handle successful commit - reset local state and notify parent |
| 324 | const handleCommitSuccess = useCallback(() => { |
| 325 | // Clear commit selection without re-initializing auto-select |
| 326 | // (prevents remaining files from being re-selected after commit) |
nothing calls this directly
no test coverage detected