Conversation
Previously the mutation returned a fake success result even when declineApplicant was not available on the contract client. This left the optimistic removal in place and showed a misleading success toast. Now it throws so the error boundary rolls back the cache and the user sees an actual error message.
|
Someone is attempting to deploy a commit to the Threadflow Team on Vercel. A member of the Team first needs to authorize it. |
|
Warning Review limit reached
More reviews will be available in 9 minutes and 39 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. 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)
📝 WalkthroughWalkthroughThe PR adds applicant decline functionality to the bounty review dashboard. A new ChangesApplication Decline Workflow
Sequence DiagramsequenceDiagram
participant User
participant Dashboard as ApplicationReviewDashboard
participant Dialog as AlertDialog
participant Hook as useDeclineApplicant
participant Contracts as ApplicationContracts
participant Cache as React Query Cache
User->>Dashboard: Click Decline button on card
Dashboard->>Dialog: Open (set applicationToDecline)
User->>Dialog: Enter reason and click Decline
Dialog->>Dashboard: handleDeclineApplicant()
Dashboard->>Hook: declineApplicant(bountyId, applicantAddress, reason)
Hook->>Cache: Optimistic update (move to declinedApplications)
Hook->>Contracts: Call contract declineApplicant()
Contracts-->>Hook: { txHash }
Hook->>Cache: Invalidate bounty detail and lists
Hook-->>Dashboard: Success
Dashboard->>Dashboard: Update compare selection, show success toast
Dashboard->>Dialog: Close dialog
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 `@hooks/use-bounty-application.ts`:
- Around line 192-209: Replace the direct global client access with the shared
resolver: call resolveApplicationClient() to obtain the application client
instead of reading (globalThis).__applicationContracts, then call
client.declineApplicant with the same payload; if resolveApplicationClient()
fails or declineApplicant is unavailable/throws, throw an ApplicationError with
an appropriate code/message (preserving the original failure semantics) rather
than a generic Error so downstream handlers can rely on ApplicationError.code;
update the block containing declineApplicant in use-bounty-application.ts to use
resolveApplicationClient() and ApplicationError consistently.
🪄 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: 6e525fc4-999e-4383-ab14-ca3cbba1ed94
📒 Files selected for processing (2)
components/bounty/application-review-dashboard.tsxhooks/use-bounty-application.ts
Address CodeRabbit review: use the shared resolver instead of direct globalThis access, and throw ApplicationError with proper code instead of generic Error.
|
@coderabbitai review — pushed a fix addressing your feedback. Now uses |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Read the hooks file
echo "=== hooks/use-bounty-application.ts ==="
cat hooks/use-bounty-application.ts
echo ""
echo "=== components/bounty/application-review-dashboard.tsx ==="
cat components/bounty/application-review-dashboard.tsx
# Also look for ApplicationError and resolveApplicationClient definitions
echo ""
echo "=== ApplicationError definition ==="
rg -n "class ApplicationError|export.*ApplicationError" --type ts -A 10
echo ""
echo "=== resolveApplicationClient definition ==="
rg -n "resolveApplicationClient" --type ts -A 10Length of output: 27503
Overall the implementation is in good shape. Items 1 and 2 are the most worthwhile cleanups; the rest are informational. Happy to approve once you've had a chance to consider them. [approve] |
What
The
useDeclineApplicanthook returns a fake success result when the contract client does not includedeclineApplicant. This leaves the optimistic cache removal in place and shows a misleading success toast.Why
Line 207 returns
{ persisted: false, result: { txHash: "local-decline-applicant" } }instead of throwing. Since the mutation "succeeds",onErrornever fires and the optimistic update is never rolled back.How
Replace the fake return with
throw new ApplicationError(...)so the error boundary rolls back the cache and the user sees an actual error message.Checklist
onError+onMutaterollback) handles this correctlySummary by CodeRabbit