fix(disputes): restore useRaiseDispute hook lost in merge#268
Conversation
PR boundlessfi#256 introduced raise-dispute-dialog.tsx which imports useRaiseDispute from hooks/use-bounty-application.ts, but a merge with main during that PR dropped the hook itself. tsc --noEmit failed on main after merge: raise-dispute-dialog.tsx:28: error TS2305: Module '@/hooks/use-bounty-application' has no exported member 'useRaiseDispute'. Re-adding the hook with the same shape as the original commit.
|
@Benjtalkshow is attempting to deploy a commit to the Threadflow Team on Vercel. A member of the Team first needs to authorize it. |
📝 WalkthroughWalkthroughAdded dispute raising capability to the bounty application with new ChangesDispute Raising and Bounty Application Hooks
Sequence DiagramsequenceDiagram
participant Caller as Component
participant Hook as useRaiseDispute
participant Client as post client
participant API as /api/disputes
participant Cache as Query Cache
Caller->>Hook: invoke with RaiseDisputeInput
Hook->>Client: post(bountyId, reason, description)
Client->>API: POST request
API-->>Client: success response
Hook->>Cache: invalidate bounty detail query
Hook->>Cache: invalidate bounty lists query
Hook-->>Caller: return RaiseDisputeResult
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 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 615-618: The console.log in useSendMessage currently prints raw
user content (message) and contributorId; remove or redact the message payload
and avoid emitting contributorId in production logs—either gate the detailed log
behind a debug flag (e.g., process.env.DEBUG or a provided isDebug variable) or
log only non-sensitive metadata such as bountyId and message length or a
redaction token; update the console.log call in useSendMessage to output safe
info (e.g., `bountyId=${bountyId}, messageLength=${message?.length}`) or wrap
the detailed message output in a debug-only branch.
🪄 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: d4abc8c7-a1cf-4086-975f-be4c77b74c81
📒 Files selected for processing (1)
hooks/use-bounty-application.ts
|
|
||
| console.log( | ||
| `[useSendMessage] Recorded message for bountyId ${bountyId}: contributorId=${contributorId}, message="${message}"`, | ||
| ); |
There was a problem hiding this comment.
Avoid logging raw user message content.
This logs the full message body and contributorId on every send. Message text is user-generated data, and emitting it verbatim risks leaking sensitive content into production logs (and adds noise). Consider gating behind a debug flag or dropping the message payload from the log.
🔒 Proposed adjustment
- console.log(
- `[useSendMessage] Recorded message for bountyId ${bountyId}: contributorId=${contributorId}, message="${message}"`,
- );
+ if (process.env.NODE_ENV !== "production") {
+ console.log(
+ `[useSendMessage] Recorded message for bountyId ${bountyId}: contributorId=${contributorId}`,
+ );
+ }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| console.log( | |
| `[useSendMessage] Recorded message for bountyId ${bountyId}: contributorId=${contributorId}, message="${message}"`, | |
| ); | |
| if (process.env.NODE_ENV !== "production") { | |
| console.log( | |
| `[useSendMessage] Recorded message for bountyId ${bountyId}: contributorId=${contributorId}`, | |
| ); | |
| } |
🤖 Prompt for 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.
In `@hooks/use-bounty-application.ts` around lines 615 - 618, The console.log in
useSendMessage currently prints raw user content (message) and contributorId;
remove or redact the message payload and avoid emitting contributorId in
production logs—either gate the detailed log behind a debug flag (e.g.,
process.env.DEBUG or a provided isDebug variable) or log only non-sensitive
metadata such as bountyId and message length or a redaction token; update the
console.log call in useSendMessage to output safe info (e.g.,
`bountyId=${bountyId}, messageLength=${message?.length}`) or wrap the detailed
message output in a debug-only branch.
PR #256 introduced
components/bounty-detail/raise-dispute-dialog.tsxwhich importsuseRaiseDisputefromhooks/use-bounty-application.ts, but a merge with main during that PR dropped the hook itself.pnpm tsc --noEmitfailed on main after merge:Re-adding the hook with the same shape as the original commit in #256. It POSTs to
/api/disputeswithbountyId,reason, anddescription, and invalidates the bounty detail and list queries on success.pnpm tsc --noEmitandpnpm lintboth clean.Summary by CodeRabbit