Skip to content

fix: add list reload after tier delete - #1020

Open
tomrndom wants to merge 1 commit into
masterfrom
fix/tier-delete-reload
Open

fix: add list reload after tier delete#1020
tomrndom wants to merge 1 commit into
masterfrom
fix/tier-delete-reload

Conversation

@tomrndom

@tomrndom tomrndom commented Jul 22, 2026

Copy link
Copy Markdown

ref: https://app.clickup.com/t/9014802374/86bb1mjrj

Signed-off-by: Tomás Castillo tcastilloboireau@gmail.com

Summary by CodeRabbit

  • Bug Fixes
    • Sponsorships are now removed from the list immediately after deletion completes.
    • The refreshed list preserves the current search, pagination, and sorting settings.

Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The sponsorship deletion handler now waits for deleteSponsorship to complete, then reloads the list using the current pagination and sorting parameters.

Changes

Sponsorship deletion flow

Layer / File(s) Summary
Delete and refresh sponsorship list
src/pages/sponsorship-types/sponsorship-list-page.js
handleDelete returns the deletion promise and calls getSponsorships after completion, resetting to the default page while preserving page size and sorting.

Estimated code review effort: 1 (Trivial) | ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: reloading the list after a tier delete.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/tier-delete-reload

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 53b15bf and 7cb7b65.

📒 Files selected for processing (1)
  • src/pages/sponsorship-types/sponsorship-list-page.js

Comment on lines +96 to +98
deleteSponsorship(sponsorshipId).then(() =>
getSponsorships(term, DEFAULT_CURRENT_PAGE, perPage, order, orderDir)
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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.

Suggested change
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.

@tomrndom
tomrndom requested a review from smarcet July 22, 2026 23:44
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