From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Thu, 25 Sep 2025 07:42:43 +0000 (-0700) Subject: Fix select option removal and pagination update (#10933) X-Git-Tag: v2.19.0~57 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5e4706993471e0d2a4b2d801586d6538c2e1d296;p=thirdparty%2Fpaperless-ngx.git Fix select option removal and pagination update (#10933) --- diff --git a/src-ui/src/app/components/common/edit-dialog/custom-field-edit-dialog/custom-field-edit-dialog.component.ts b/src-ui/src/app/components/common/edit-dialog/custom-field-edit-dialog/custom-field-edit-dialog.component.ts index 617d825b22..8e8bddfabe 100644 --- a/src-ui/src/app/components/common/edit-dialog/custom-field-edit-dialog/custom-field-edit-dialog.component.ts +++ b/src-ui/src/app/components/common/edit-dialog/custom-field-edit-dialog/custom-field-edit-dialog.component.ts @@ -177,10 +177,16 @@ export class CustomFieldEditDialogComponent } public removeSelectOption(index: number) { - this.selectOptions.removeAt(index) - this._allSelectOptions.splice( - index + (this.selectOptionsPage - 1) * SELECT_OPTION_PAGE_SIZE, - 1 + const globalIndex = + index + (this.selectOptionsPage - 1) * SELECT_OPTION_PAGE_SIZE + this._allSelectOptions.splice(globalIndex, 1) + + const totalPages = Math.max( + 1, + Math.ceil(this._allSelectOptions.length / SELECT_OPTION_PAGE_SIZE) ) + const targetPage = Math.min(this.selectOptionsPage, totalPages) + + this.selectOptionsPage = targetPage } }