Skip to content

[GitHub PRs] Switching back to PR with in-progress review doesn't show running review state #888

@linear

Description

@linear
  • What: In-progress PR review not displayed when switching back to the PR after navigating away
  • Where: PRDetail.tsx:383 (status computation), useGitHubPRs.ts:94-102 (state retrieval)
  • Impact: Users can't see running review status when switching PRs, must click "Followup Review" to reveal the in-progress review

Problem Description

The PR review state management uses Zustand with in-memory state keyed by projectId:prNumber. When a PR review is started, the store maintains isReviewing: true and progress data. However, the prStatus computation in PRDetail.tsx checks reviewResult before checking isReviewing. Since reviewResult is null during an active review, it returns 'not_reviewed' status, preventing the UI from displaying the running review.

Affected Areas

  • apps/frontend/src/renderer/components/github-prs/components/PRDetail.tsx:383-391 - Status computation missing isReviewing check
  • apps/frontend/src/renderer/components/github-prs/hooks/useGitHubPRs.ts:94-102 - State retrieval from store
  • apps/frontend/src/renderer/stores/github/pr-review-store.ts:97-115 - setPRReviewProgress function

Steps to Reproduce

  1. Navigate to GitHub PRs section
  2. Select PR Auto claude/add followup on done task #1 and click "Run AI Review"
  3. While review is running, select a different PR (#2)
  4. Switch back to PR Auto claude/add followup on done task #1
  5. Observe: The running review is not shown (no progress indicator)
  6. Click "Followup Review" button
  7. Observe: The running review suddenly appears

Expected Behavior

When switching back to a PR with an in-progress review, the running review state should be immediately visible with:

  • Progress indicator showing current phase
  • Cancel button available
  • Real-time progress updates

Actual Behavior

When switching back to a PR with an in-progress review:

  • No progress indicator is shown
  • Running review is not displayed
  • User must click "Followup Review" to reveal the in-progress review
  • This incorrectly suggests starting a new follow-up review when one is already running

Proposed Solution

Modify the prStatus computation in PRDetail.tsx:383 to check isReviewing FIRST before checking reviewResult:

const prStatus = useMemo(() => {

// Check for in-progress review FIRST (before checking result)
if (isReviewing) {
  return {
    status: 'reviewing',
    label: t('prReview.aiReviewInProgress'),
    description: reviewProgress?.message || t('prReview.analysisInProgress'),
    icon: <Bot className="h-5 w-5 animate-pulse" />,
    color: 'bg-blue-500/10 text-blue-500 border-blue-500/30',
  };
}
// Then check for completed review
if (!reviewResult || !reviewResult.success) {
  return {
    status: 'not_reviewed',
    ...
  };
}
// ... rest of status logic

}, [isReviewing, reviewProgress, reviewResult, ...]);

Ensure the ReviewStatusTree component handles the new 'reviewing' status correctly.

Code References

  • apps/frontend/src/renderer/components/github-prs/components/PRDetail.tsx:383-391 - Status computation missing isReviewing check
  • apps/frontend/src/renderer/components/github-prs/components/ReviewStatusTree.tsx:56-68 - "not_reviewed" status display
  • apps/frontend/src/renderer/components/github-prs/hooks/useGitHubPRs.ts:94-102 - State retrieval logic
  • apps/frontend/src/renderer/stores/github/pr-review-store.ts:97-115 - Progress update handler

Additional Notes

  • The store correctly maintains the in-progress review state (isReviewing: true, progress data)
  • The issue is purely in the UI layer - the state exists but isn't being displayed
  • The useMemo dependency array includes prReviews, so state updates should trigger re-renders
  • This is a display/logic bug, not a data persistence bug

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions