Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Bugfix/fix case-insensitive sorting in accounts table (#6178)

Thomas Kauld58e5f73e916
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b67aeea4aa..b3fdc21fb1 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 7452b604cd..9c1a0f104d 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 699de6d7eb..fe91e1edaa 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;