From 5340d727f830353c2f9476e36fc6284df2e13c13 Mon Sep 17 00:00:00 2001 From: Maksym Tsymbarov Date: Fri, 27 Nov 2026 16:44:19 +0100 Subject: [PATCH] Fixed the Go to search showing the previous user's menu items after Login as or menu changes (#16840) * Fixed Go to menu search crashing after selecting a link * PR comments fixes --- .../src/app/modules/home/menu/goto-menu.component.html | 4 ++-- ui-ngx/src/app/modules/home/menu/goto-menu.component.ts | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/ui-ngx/src/app/modules/home/menu/goto-menu.component.html b/ui-ngx/src/app/modules/home/menu/goto-menu.component.html index bba1ffe39a..41e8f677c5 100644 --- a/ui-ngx/src/app/modules/home/menu/goto-menu.component.html +++ b/ui-ngx/src/app/modules/home/menu/goto-menu.component.html @@ -45,7 +45,7 @@ @if (gotoMenuResult.hasMatches) { @if (gotoMenuResult.nameMatches.length) { @for (link of gotoMenuResult.nameMatches; track link) { - + } @@ -55,7 +55,7 @@ } @if (gotoMenuResult.crumbMatches.length) { @for (link of gotoMenuResult.crumbMatches; track link) { - + } diff --git a/ui-ngx/src/app/modules/home/menu/goto-menu.component.ts b/ui-ngx/src/app/modules/home/menu/goto-menu.component.ts index 86d2a32832..0b0ba113b1 100644 --- a/ui-ngx/src/app/modules/home/menu/goto-menu.component.ts +++ b/ui-ngx/src/app/modules/home/menu/goto-menu.component.ts @@ -116,10 +116,10 @@ export class GotoMenuComponent implements OnInit, OnDestroy { this.router.navigate([link.path], { queryParams: link.queryParams }).then(); } - private fetchLinks(searchText?: string): Observable { - this.searchText = searchText; + private fetchLinks(searchText: string): Observable { + const query = (searchText ?? '').trim().toLowerCase(); return this.allLinks().pipe( - map((links) => this.filterLinks(links)) + map((links) => this.filterLinks(links, query)) ); } @@ -140,8 +140,7 @@ export class GotoMenuComponent implements OnInit, OnDestroy { return this.allLinksObservable$; } - private filterLinks(links: GotoMenuLink[]): GotoMenuResult { - const query = this.searchText.trim().toLowerCase(); + private filterLinks(links: GotoMenuLink[], query: string): GotoMenuResult { const nameMatches: GotoMenuLink[] = []; let crumbMatches: GotoMenuLink[] = []; for (const link of links) {