Skip to content

fix(accounts): handle empty account comment lookups#65

Merged
tomcasaburi merged 1 commit into
masterfrom
fix/account-comment-empty-lookup
Jun 24, 2026
Merged

fix(accounts): handle empty account comment lookups#65
tomcasaburi merged 1 commit into
masterfrom
fix/account-comment-empty-lookup

Conversation

@tomcasaburi

@tomcasaburi tomcasaburi commented Jun 24, 2026

Copy link
Copy Markdown
Member

Summary

  • Guard useAccountComment's commentCid fallback so an empty lookup does not treat undefined === undefined as a matched account mapping.
  • Add a regression test for calling useAccountComment() before an account/comment lookup is available.
  • Bump the package to 0.1.21 and regenerate the built dist output.

Context

5chan's built smoke test caught this after moving from its local safe wrapper to direct useAccountComment calls: home render crashed before account state loaded because the empty lookup tried to read accountCommentIndex from an undefined mapping.

Verification

  • corepack yarn test src/hooks/accounts/accounts.test.ts
  • corepack yarn prettier
  • corepack yarn type-check
  • corepack yarn lint (existing warnings, 0 errors)
  • corepack yarn build
  • corepack yarn test
  • corepack yarn test:coverage
  • git diff --check

Note

Low Risk
Small guard in comment index resolution plus tests; no auth or data-model changes.

Overview
Fixes a crash when useAccountComment runs before account/comment lookup data exists (e.g. 5chan home render). The commentCid fallback no longer treats a missing store entry as a match via undefined === undefined; it only uses the mapping when commentCidToAccountComment is defined and its accountId matches.

Adds a test that calling useAccountComment() with no index/CID yields initializing and empty errors. Version bumped to 0.1.21 with matching dist output.

Reviewed by Cursor Bugbot for commit cf97c11. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@tomcasaburi, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b7923449-a0b1-4d6c-abdb-cab141436da5

📥 Commits

Reviewing files that changed from the base of the PR and between d584438 and cf97c11.

⛔ Files ignored due to path filters (2)
  • dist/hooks/accounts/accounts.js is excluded by !**/dist/**
  • dist/hooks/accounts/accounts.js.map is excluded by !**/dist/**, !**/*.map
📒 Files selected for processing (3)
  • package.json
  • src/hooks/accounts/accounts.test.ts
  • src/hooks/accounts/accounts.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/account-comment-empty-lookup

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@tomcasaburi tomcasaburi merged commit eb1bd79 into master Jun 24, 2026
8 checks passed
@tomcasaburi tomcasaburi deleted the fix/account-comment-empty-lookup branch June 24, 2026 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant