fix(communities): suppress retriable load errors#59
Conversation
📝 WalkthroughWalkthroughThe PR adds retriable error filtering to the communities store. A new ChangesRetriable Error Filtering
🎯 2 (Simple) | ⏱️ ~10 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 `@src/stores/communities/communities-store.ts`:
- Around line 142-146: The callback that cleans up pendingCommunityErrorTimers
assumes pendingCommunityErrorTimers[communityKey] still exists and can crash or
re-add a stale error if clearPendingCommunityErrors removed it first; update the
callback in the cleanup path to first guard that the key exists (e.g., if
(!pendingCommunityErrorTimers[communityKey]) return) before calling .filter and
checking length, and only proceed to delete the key if the array exists and
becomes empty—this ensures clearPendingCommunityErrors can safely remove the
entry and prevents the timeout callback from throwing or re-appending stale
errors when it runs later.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: c99f2bff-5862-44e3-8b81-2565440c2090
📒 Files selected for processing (2)
src/stores/communities/communities-store.test.tssrc/stores/communities/communities-store.ts
|
Addressed the valid CodeRabbit finding in Local verification after the review fix:
|
Summary
details.retriableError === trueVerification
yarn prettieryarn testyarn buildgit diff --checkyarn test:coverage:hooks-storesran all tests successfully; the strict coverage verifier still exits nonzero on existing unrelated hook/store coverage gaps. The touchedsrc/stores/communities/communities-store.tsreports 100% statements/branches/functions/lines.Note
Low Risk
Scoped to community error scheduling in the Zustand store with regression tests; no auth, payments, or API contract changes.
Overview
Community load errors from pkc-js that set
details.retriableError === trueare no longer queued into the communities store’s delayed error list, so transient fetch failures should not surface in UI error state after the grace period.Non-retriable errors still use the existing 1s grace delay and accumulate per community. The delayed callback now bails out if its timeout was already removed from the pending list (e.g. after a successful
updateclears pending timers), avoiding stale errors being written back.Tests cover retriable suppression, non-retriable batching, and cleared-pending timeout behavior.
Reviewed by Cursor Bugbot for commit 04ae6f2. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
Release Notes