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.
This commit is contained in:
Andy
2026-01-13 10:17:52 +01:00
committed by AndyMik90
parent 5d07d5f196
commit 1babcc86af
@@ -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