feat: Pagination not updating after last item deletion (#3120)

This commit is contained in:
Zheming Bao
2024-08-13 16:09:16 +08:00
committed by GitHub
parent ab5fcf848e
commit 38e389e8c8
23 changed files with 113 additions and 69 deletions

View File

@ -61,9 +61,11 @@ class WebhookListPage extends BaseListPage {
.then((res) => {
if (res.status === "ok") {
Setting.showMessage("success", i18next.t("general:Successfully deleted"));
this.setState({
data: Setting.deleteRow(this.state.data, i),
pagination: {total: this.state.pagination.total - 1},
this.fetch({
pagination: {
...this.state.pagination,
current: this.state.pagination.current > 1 && this.state.data.length === 1 ? this.state.pagination.current - 1 : this.state.pagination.current,
},
});
} else {
Setting.showMessage("error", `${i18next.t("general:Failed to delete")}: ${res.msg}`);