fix: resolve race condition and state accumulator in file browser#265
fix: resolve race condition and state accumulator in file browser#265HUmnanANirudh wants to merge 2 commits into
Conversation
|
Warning Review limit reached
More reviews will be available in 53 minutes and 18 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
file-browser.js querySparql refactor
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@public/js/components/file-browser/file-browser.js`:
- Around line 156-158: The catch block in file-browser request handling clears
loading state without checking whether the failure belongs to the active
request, which can let an older SPARQL request override a newer one. Update the
error path in the relevant request flow (the same place that uses the request
revision for success handling) to compare the current request revision before
calling ctrl.isLoading = false or otherwise mutating UI state, and ignore stale
failures the same way the success path does.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 40a01e47-d674-4daf-a24d-0f78f8c65576
📒 Files selected for processing (1)
public/js/components/file-browser/file-browser.js
…scope apply to error handler
|
@m1ci @holycrab13 Could you please review this when you have a chance? |
Summary
This PR fixes issue #262 where switching between versions or content variants could cause the File Browser to display incorrect total size and file count values.
Root Cause
Multiple SPARQL requests can finish out of order, allowing older responses to overwrite newer ones and display incorrect file counts and total size. This change also computes the totals using local variables before updating the UI state.
Changes
Summary by CodeRabbit