Unify partner approval on bulk approve modal#3736
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughReplaces per-row single-approve modal/state with a payload-driven bulk-approve modal. Pages and sheets call an exported openBulkApprove(payload) to open the modal for one or many partners; the modal handles single vs bulk approval, keyboard shortcuts, selection/grouping, and post-approve mutations/toast. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
rect rgba(200,200,255,0.5)
participant Page as Page (Table / Row)
participant Sheet as PartnerApplicationSheet
participant Hook as useBulkApprovePartnersModal
participant Modal as BulkApprovePartnersModal
participant API as Server/API
participant Cache as SWR/Cache
end
Page->>Hook: openBulkApprove({ partners })
Hook->>Modal: set bulkApprovePayload -> open modal
Sheet->>Hook: openBulkApprove(single-partner payload)
Modal->>Modal: user confirms (Approve)
Modal->>API: bulkApprovePartnersAction or approvePartnerAction
API-->>Modal: success
Modal->>Cache: mutate("/api/partners") & mutate("/api/partners/count")
Modal->>Modal: clear bulkApprovePayload (close)
Modal->>Page: show success toast / call onApproveSuccess
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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
🧹 Nitpick comments (1)
apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/applications/rejected/page-client.tsx (1)
139-140: Wire the row menu intoopenBulkApprovetoo.This page now mounts the payload-based approve modal, but only the sheet can open it.
PartnerRowMenuButtonin this same file still approves throughuseConfirmModal, so rejected applications keep a second flow that bypasses the shared group-assignment/success handling.Also applies to: 385-406
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/web/app/app.dub.co/`(dashboard)/[slug]/(ee)/program/partners/applications/rejected/page-client.tsx around lines 139 - 140, The PartnerRowMenuButton flow still uses useConfirmModal instead of the shared bulk-approve flow, so update the row menu to call openBulkApprove from useBulkApprovePartnersModal (the same hook that provides BulkApprovePartnersModal) instead of invoking useConfirmModal; pass a single-item payload (the partner id/object) into openBulkApprove so the modal receives the same payload-based shape as the sheet, and remove/replace the old confirm modal success handling so all approvals go through the shared group-assignment/success logic found in the bulk-approve modal; make this change for the PartnerRowMenuButton usages in this file (including the other instance around the 385-406 area) so both sheet and row-menu trigger the identical openBulkApprove path.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/web/ui/partners/partner-application-sheet.tsx`:
- Around line 238-247: openApproveModal is passing initialGroupId but the
sheet's selectedGroupId is only reset when partner.groupId changes, causing a
previous unsaved selection to leak to a new partner; update the logic that
initializes/reset selectedGroupId so it runs when the partner identity changes
(e.g. watch partner or partner.id instead of partner.groupId) and set
selectedGroupId = partner.groupId (or null) on partner change, and ensure any
useCallback/useEffect that reads selectedGroupId or initialGroupId (such as
openApproveModal and its dependency array) includes the correct dependencies
(partner or partner.id and selectedGroupId) so each partner gets its own fresh
group selection.
---
Nitpick comments:
In
`@apps/web/app/app.dub.co/`(dashboard)/[slug]/(ee)/program/partners/applications/rejected/page-client.tsx:
- Around line 139-140: The PartnerRowMenuButton flow still uses useConfirmModal
instead of the shared bulk-approve flow, so update the row menu to call
openBulkApprove from useBulkApprovePartnersModal (the same hook that provides
BulkApprovePartnersModal) instead of invoking useConfirmModal; pass a
single-item payload (the partner id/object) into openBulkApprove so the modal
receives the same payload-based shape as the sheet, and remove/replace the old
confirm modal success handling so all approvals go through the shared
group-assignment/success logic found in the bulk-approve modal; make this change
for the PartnerRowMenuButton usages in this file (including the other instance
around the 385-406 area) so both sheet and row-menu trigger the identical
openBulkApprove path.
🪄 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: a648d801-b4a8-4064-b4ad-fd973fbff8c7
📒 Files selected for processing (4)
apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/applications/page-client.tsxapps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/applications/rejected/page-client.tsxapps/web/ui/modals/bulk-approve-partners-modal.tsxapps/web/ui/partners/partner-application-sheet.tsx
|
@coderabbitai full review, any breaking changes? |
🧩 Analysis chainLet me inspect the codebase for all usages of the changed APIs before giving a definitive answer. 🏁 Script executed: Length of output: 424 🏁 Script executed: Length of output: 28154
✅ No Breaking Changes
|
| Status | |
|---|---|
| Breaking changes | ✅ None |
Dead code (approve-partner-application-modal.tsx) |
|
| Dual approval in rejected page | |
| Approval branching logic |
The PR's unification goal is solid — routing both single and bulk approvals through one modal reduces duplication. The main follow-up action is deleting approve-partner-application-modal.tsx and clarifying the second approvePartnerAction usage in the rejected page.
✅ Actions performed
Full review triggered.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
apps/web/ui/partners/partner-application-sheet.tsx (1)
35-35: Delete the unusedapprove-partner-application-modal.tsxfile.This modal has no remaining callers in the codebase. The
PartnerApprovalcomponent inpartner-application-sheet.tsxhas migrated entirely to useonOpenBulkApprove, making the legacy modal dead code. Removing it prevents accidental reuse and keeps the codebase clean.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/web/ui/partners/partner-application-sheet.tsx` at line 35, The legacy modal file approve-partner-application-modal.tsx is unused and should be removed: delete that file and any imports referencing it; verify PartnerApproval usage in partner-application-sheet.tsx now goes through onOpenBulkApprove (the onOpenBulkApprove: (payload: BulkApprovePartnersPayload) => void signature) and remove or update any leftover references (types, exports, or stories/tests) that point to approve-partner-application-modal.tsx to avoid dangling imports.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@apps/web/ui/partners/partner-application-sheet.tsx`:
- Line 35: The legacy modal file approve-partner-application-modal.tsx is unused
and should be removed: delete that file and any imports referencing it; verify
PartnerApproval usage in partner-application-sheet.tsx now goes through
onOpenBulkApprove (the onOpenBulkApprove: (payload: BulkApprovePartnersPayload)
=> void signature) and remove or update any leftover references (types, exports,
or stories/tests) that point to approve-partner-application-modal.tsx to avoid
dangling imports.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 52fc40ec-f28c-4d29-9c6a-47ee368c6934
📒 Files selected for processing (4)
apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/applications/page-client.tsxapps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/applications/rejected/page-client.tsxapps/web/ui/modals/bulk-approve-partners-modal.tsxapps/web/ui/partners/partner-application-sheet.tsx
| const { openBulkApprove, BulkApprovePartnersModal } = | ||
| useBulkApprovePartnersModal(); |
There was a problem hiding this comment.
Rejected-page approval is still split across two code paths.
These additions wire the bulk-approve modal into the sheet, but PartnerRowMenuButton below still approves directly via approvePartnerAction/useConfirmModal on Lines 464-488. Rejected applications can therefore still bypass the shared group-selection and post-approve flow, so this page is not actually unified yet. Please thread openBulkApprove into the row menu as well and remove the legacy direct-approve path here.
Also applies to: 385-406
Summary by CodeRabbit
New Features
Improvements