-
Notifications
You must be signed in to change notification settings - Fork 4
fix: reload table after archive/unarchive rows #938
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
77e9978
df2963d
035ae44
b8545c5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,6 +48,7 @@ import { | |
| import { rateCellValidation } from "../../../../../../../utils/yup"; | ||
| import { rateToCents } from "../../../../../../../utils/rate-helpers"; | ||
| import Restrict from "../../../../../../../routes/restrict"; | ||
| import { getSafePageAfterRemove } from "../../../../../../../utils/methods"; | ||
|
|
||
| const SponsorFormsManageItems = ({ | ||
| term, | ||
|
|
@@ -151,9 +152,37 @@ const SponsorFormsManageItems = ({ | |
| }; | ||
|
|
||
| const handleArchiveItem = (item) => | ||
| item.is_archived | ||
| (item.is_archived | ||
| ? unarchiveSponsorCustomizedFormItem(formId, item.id) | ||
| : archiveSponsorCustomizedFormItem(formId, item.id); | ||
| : archiveSponsorCustomizedFormItem(formId, item.id) | ||
| ) | ||
| .then(() => { | ||
| const safePage = getSafePageAfterRemove( | ||
| totalCount, | ||
| perPage, | ||
| currentPage | ||
| ); | ||
| getSponsorCustomizedFormItems( | ||
| formId, | ||
| term, | ||
| safePage, | ||
| perPage, | ||
| order, | ||
| orderDir, | ||
| showArchived | ||
| ); | ||
| }) | ||
| .catch(() => | ||
| getSponsorCustomizedFormItems( | ||
| formId, | ||
| term, | ||
| currentPage, | ||
| perPage, | ||
| order, | ||
| orderDir, | ||
| showArchived | ||
| ) | ||
| ); | ||
|
Comment on lines
154
to
+185
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Safe-page logic is applied to both directions, but removal is filter-dependent.
Suggested adjustment const handleArchiveItem = (item) =>
(item.is_archived
? unarchiveSponsorCustomizedFormItem(formId, item.id)
: archiveSponsorCustomizedFormItem(formId, item.id)
)
.then(() => {
- const safePage = getSafePageAfterRemove(
- totalCount,
- perPage,
- currentPage
- );
+ const isRemoveLikeMutation = !showArchived; // adjust based on actual filter semantics
+ const safePage = isRemoveLikeMutation
+ ? getSafePageAfterRemove(totalCount, perPage, currentPage)
+ : currentPage;
getSponsorCustomizedFormItems(
formId,
term,🤖 Prompt for AI Agents |
||
|
|
||
| const handleShowArchivedItems = (ev) => { | ||
| getSponsorCustomizedFormItems( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on unarchive there is no need to calculate safePage, since the list of templates in the page wont change. User must have selected "Show archived" to see the unarchive button, so the only thing that changes is the template item status