]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Fix: move hierarchical order logic in dropdown sorting (#11128)
authorshamoon <4887959+shamoon@users.noreply.github.com>
Wed, 22 Oct 2025 17:27:39 +0000 (10:27 -0700)
committerGitHub <noreply@github.com>
Wed, 22 Oct 2025 17:27:39 +0000 (10:27 -0700)
src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.ts

index 6107438da9b4651a4cfe5c341a6e95ca30bfa723..3ca6edc5c8f7084a85b817a314317137f7030a27 100644 (file)
@@ -114,13 +114,6 @@ export class FilterableDropdownSelectionModel {
           b.id == NEGATIVE_NULL_FILTER_VALUE)
       ) {
         return 1
-      }
-
-      // Preserve hierarchical order when provided (e.g., Tags)
-      const ao = (a as any)['orderIndex']
-      const bo = (b as any)['orderIndex']
-      if (ao !== undefined && bo !== undefined) {
-        return ao - bo
       } else if (
         this.getNonTemporary(a.id) == ToggleableItemState.NotSelected &&
         this.getNonTemporary(b.id) != ToggleableItemState.NotSelected
@@ -143,6 +136,13 @@ export class FilterableDropdownSelectionModel {
         this.getDocumentCount(a.id) < this.getDocumentCount(b.id)
       ) {
         return 1
+      }
+
+      // Preserve hierarchical order when provided (e.g., Tags)
+      const ao = (a as any)['orderIndex']
+      const bo = (b as any)['orderIndex']
+      if (ao !== undefined && bo !== undefined) {
+        return ao - bo
       } else {
         return a.name.localeCompare(b.name)
       }