Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/pages/sponsorship-types/sponsorship-list-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ const SponsorshipListPage = ({
};

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

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.

};

const columns = [
Expand Down
Loading