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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user