fix(accounts): handle empty account comment lookups#65
Conversation
|
Warning Review limit reached
More reviews will be available in 39 minutes and 13 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: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (3)
✨ 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 |
Summary
useAccountComment'scommentCidfallback so an empty lookup does not treatundefined === undefinedas a matched account mapping.useAccountComment()before an account/comment lookup is available.0.1.21and regenerate the builtdistoutput.Context
5chan's built smoke test caught this after moving from its local safe wrapper to direct
useAccountCommentcalls: home render crashed before account state loaded because the empty lookup tried to readaccountCommentIndexfrom an undefined mapping.Verification
corepack yarn test src/hooks/accounts/accounts.test.tscorepack yarn prettiercorepack yarn type-checkcorepack yarn lint(existing warnings, 0 errors)corepack yarn buildcorepack yarn testcorepack yarn test:coveragegit diff --checkNote
Low Risk
Small guard in comment index resolution plus tests; no auth or data-model changes.
Overview
Fixes a crash when
useAccountCommentruns before account/comment lookup data exists (e.g. 5chan home render). ThecommentCidfallback no longer treats a missing store entry as a match viaundefined === undefined; it only uses the mapping whencommentCidToAccountCommentis defined and itsaccountIdmatches.Adds a test that calling
useAccountComment()with no index/CID yieldsinitializingand empty errors. Version bumped to0.1.21with matchingdistoutput.Reviewed by Cursor Bugbot for commit cf97c11. Bugbot is set up for automated code reviews on this repo. Configure here.