fix: add list reload after tier delete - #1020
Conversation
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
📝 WalkthroughWalkthroughThe sponsorship deletion handler now waits for ChangesSponsorship deletion flow
Estimated code review effort: 1 (Trivial) | ~2 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 `@src/pages/sponsorship-types/sponsorship-list-page.js`:
- Around line 96-98: Update the refresh call in the deleteSponsorship completion
flow to use the currentPage value instead of DEFAULT_CURRENT_PAGE, preserving
the user’s current pagination after deletion. If the deletion can remove the
final row on the page, clamp the requested page to the last available page
before calling getSponsorships.
🪄 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: f0a46d28-6adf-401e-8124-ce1a33d827f7
📒 Files selected for processing (1)
src/pages/sponsorship-types/sponsorship-list-page.js
| deleteSponsorship(sponsorshipId).then(() => | ||
| getSponsorships(term, DEFAULT_CURRENT_PAGE, perPage, order, orderDir) | ||
| ); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Preserve the current page when refreshing after deletion.
This reload resets every deletion to DEFAULT_CURRENT_PAGE, so users on page 2+ are unexpectedly returned to page 1. Use currentPage here, with clamping to the last available page if deleting the final row on the current page is a concern.
Proposed fix
deleteSponsorship(sponsorshipId).then(() =>
- getSponsorships(term, DEFAULT_CURRENT_PAGE, perPage, order, orderDir)
+ getSponsorships(term, currentPage, perPage, order, orderDir)
);📝 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.
| deleteSponsorship(sponsorshipId).then(() => | |
| getSponsorships(term, DEFAULT_CURRENT_PAGE, perPage, order, orderDir) | |
| ); | |
| deleteSponsorship(sponsorshipId).then(() => | |
| getSponsorships(term, currentPage, perPage, order, orderDir) | |
| ); |
🤖 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 `@src/pages/sponsorship-types/sponsorship-list-page.js` around lines 96 - 98,
Update the refresh call in the deleteSponsorship completion flow to use the
currentPage value instead of DEFAULT_CURRENT_PAGE, preserving the user’s current
pagination after deletion. If the deletion can remove the final row on the page,
clamp the requested page to the last available page before calling
getSponsorships.
ref: https://app.clickup.com/t/9014802374/86bb1mjrj
Signed-off-by: Tomás Castillo tcastilloboireau@gmail.com
Summary by CodeRabbit