fix: reload table after archive/unarchive rows#938
Conversation
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (11)
📝 WalkthroughWalkthroughThis PR introduces a utility function to safely recalculate pagination page numbers after archiving or unarchiving list items, then applies it consistently across nine different page and tab components. The change prevents users from being left on invalid empty pages after removing items from the current view. ChangesSafe Pagination After Archive/Unarchive
Sequence DiagramsequenceDiagram
participant User
participant ListComponent
participant ArchiveAPI
participant getSafePageAfterRemove
participant ReloadAPI
User->>ListComponent: Click archive/unarchive item
ListComponent->>ArchiveAPI: archiveItem() or unarchiveItem()
ArchiveAPI-->>ListComponent: Promise resolves
ListComponent->>getSafePageAfterRemove: Calculate safe page from (totalCount-1, perPage, currentPage)
getSafePageAfterRemove-->>ListComponent: safePage (clamped to valid range)
ListComponent->>ReloadAPI: fetchItems(page = safePage)
ReloadAPI-->>ListComponent: Updated list
ListComponent-->>User: Display updated list on valid page
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
ref: https://app.clickup.com/t/86b7v230m
Signed-off-by: Tomás Castillo tcastilloboireau@gmail.com
Summary by CodeRabbit