From 1babcc86aff95f646d73ed64e6129f0f32f86dde Mon Sep 17 00:00:00 2001 From: Andy <119136210+AndyMik90@users.noreply.github.com> Date: Tue, 13 Jan 2026 10:17:52 +0100 Subject: [PATCH] fix(github-prs): prevent preloading of PRs currently under review (#1006) - Updated logic to skip PRs that are currently being reviewed when determining which PRs need preloading. - Enhanced condition to only fetch existing review data from disk if no review is in progress, ensuring that ongoing reviews are not overwritten by stale data. --- .../renderer/components/github-prs/hooks/useGitHubPRs.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/frontend/src/renderer/components/github-prs/hooks/useGitHubPRs.ts b/apps/frontend/src/renderer/components/github-prs/hooks/useGitHubPRs.ts index 8ddadb99..00170386 100644 --- a/apps/frontend/src/renderer/components/github-prs/hooks/useGitHubPRs.ts +++ b/apps/frontend/src/renderer/components/github-prs/hooks/useGitHubPRs.ts @@ -178,9 +178,10 @@ export function useGitHubPRs( } // Batch preload review results for PRs not in store (single IPC call) + // Skip PRs that are currently being reviewed - their state is managed by IPC listeners const prsNeedingPreload = result.filter((pr) => { const existingState = getPRReviewState(projectId, pr.number); - return !existingState?.result; + return !existingState?.result && !existingState?.isReviewing; }); if (prsNeedingPreload.length > 0) { @@ -291,8 +292,9 @@ export function useGitHubPRs( // Load existing review from disk if not already in store const existingState = getPRReviewState(projectId, prNumber); - // Only fetch from disk if we don't have a result in the store - if (!existingState?.result) { + // Only fetch from disk if we don't have a result in the store AND no review is running + // If a review is in progress, the state is managed by IPC listeners - don't overwrite it + if (!existingState?.result && !existingState?.isReviewing) { window.electronAPI.github.getPRReview(projectId, prNumber).then((result) => { if (result) { // Update store with the loaded result