From d58e5f73e9162a589283da8c729bd5813f818bb9 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Fri, 9 Jan 2026 19:56:19 +0100 Subject: [PATCH] Bugfix/fix case-insensitive sorting in accounts table (#6178) * Fix case-insensitive sorting by account name * Update changelog --- CHANGELOG.md | 1 + libs/common/src/lib/helper.ts | 11 +++++++++++ .../lib/accounts-table/accounts-table.component.ts | 6 +++--- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b67aeea4a..b3fdc21fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Fixed the filtering by asset class in the endpoint `GET api/v1/portfolio/holdings` +- Fixed the case-insensitive sorting in the accounts table component ## 2.228.0 - 2026-01-03 diff --git a/libs/common/src/lib/helper.ts b/libs/common/src/lib/helper.ts index 7452b604c..9c1a0f104 100644 --- a/libs/common/src/lib/helper.ts +++ b/libs/common/src/lib/helper.ts @@ -12,6 +12,7 @@ import { subDays } from 'date-fns'; import { ca, de, es, fr, it, nl, pl, pt, tr, uk, zhCN } from 'date-fns/locale'; +import { get, isNil, isString } from 'lodash'; import { DEFAULT_CURRENCY, @@ -242,6 +243,16 @@ export function getLocale() { return navigator.language ?? locale; } +export function getLowercase(object: object, path: string) { + const value = get(object, path); + + if (isNil(value)) { + return ''; + } + + return isString(value) ? value.toLocaleLowerCase() : value; +} + export function getNumberFormatDecimal(aLocale?: string) { const formatObject = new Intl.NumberFormat(aLocale).formatToParts(9999.99); diff --git a/libs/ui/src/lib/accounts-table/accounts-table.component.ts b/libs/ui/src/lib/accounts-table/accounts-table.component.ts index 699de6d7e..fe91e1eda 100644 --- a/libs/ui/src/lib/accounts-table/accounts-table.component.ts +++ b/libs/ui/src/lib/accounts-table/accounts-table.component.ts @@ -1,5 +1,5 @@ import { ConfirmationDialogType } from '@ghostfolio/common/enums'; -import { getLocale } from '@ghostfolio/common/helper'; +import { getLocale, getLowercase } from '@ghostfolio/common/helper'; import { GfEntityLogoComponent } from '@ghostfolio/ui/entity-logo'; import { NotificationService } from '@ghostfolio/ui/notifications'; import { GfValueComponent } from '@ghostfolio/ui/value'; @@ -32,7 +32,6 @@ import { trashOutline, walletOutline } from 'ionicons/icons'; -import { get } from 'lodash'; import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader'; import { Subject, Subscription } from 'rxjs'; @@ -133,8 +132,9 @@ export class GfAccountsTableComponent implements OnChanges, OnDestroy { this.isLoading = true; this.dataSource = new MatTableDataSource(this.accounts); + this.dataSource.sortingDataAccessor = getLowercase; + this.dataSource.sort = this.sort; - this.dataSource.sortingDataAccessor = get; if (this.accounts) { this.isLoading = false;