diff --git a/viewer/src/app/wallets/wallets-list/wallets-list.component.ts b/viewer/src/app/wallets/wallets-list/wallets-list.component.ts index 609f611..478f17a 100644 --- a/viewer/src/app/wallets/wallets-list/wallets-list.component.ts +++ b/viewer/src/app/wallets/wallets-list/wallets-list.component.ts @@ -212,7 +212,7 @@ export class WalletsListComponent implements OnInit, AfterViewInit { .subscribe(async (res: WalletFilter) => { this.router.navigate([], { relativeTo: this.route, - fragment: JSON.stringify(res), + fragment: this.reduceObject(res ?? {}), replaceUrl: false, }); this.filter = res; @@ -220,6 +220,20 @@ export class WalletsListComponent implements OnInit, AfterViewInit { }); } + /** + * Removes all elements from the object that are undefined + * @param object + */ + private reduceObject(object: any) { + Object.keys(object).forEach((key) => { + if (object[key] === null) { + delete object[key]; + } + }); + if (Object.keys(object).length === 0) return undefined; + return JSON.stringify(object); + } + /** * Load the filtered wallets */