From 6609b64076844ed8e32237289c54d1cd8f0dcd99 Mon Sep 17 00:00:00 2001 From: genja Date: Mon, 24 Aug 2026 21:06:03 +0200 Subject: [PATCH] fixed wrong fuzzy search toggler behaviour on navigating --- .../search-results.component.ts | 37 ++++++++----------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/webapp/src/app/modules/keywords-search/search-results/search-results.component.ts b/webapp/src/app/modules/keywords-search/search-results/search-results.component.ts index 1588a49a..e2928df0 100644 --- a/webapp/src/app/modules/keywords-search/search-results/search-results.component.ts +++ b/webapp/src/app/modules/keywords-search/search-results/search-results.component.ts @@ -80,8 +80,8 @@ export class KeywordsSearchResultsComponent { path: 'persons', queryParams: { keywords: this.state.payload()?.keywords?.join(','), - fuzzy: this.tabFuzzyValue('persons'), - topics: this.tabFuzzyValue('persons') ? this.state.topicIds() : null, + fuzzy: this.currentFuzzy(), + topics: this.currentFuzzy() ? this.state.topicIds() : null, topicId: null, }, queryParamsHandling: 'replace', @@ -93,8 +93,8 @@ export class KeywordsSearchResultsComponent { path: 'projects', queryParams: { keywords: this.state.payload()?.keywords?.join(','), - fuzzy: this.tabFuzzyValue('projects'), - topics: this.tabFuzzyValue('projects') ? this.state.topicIds() : null, + fuzzy: this.currentFuzzy(), + topics: this.currentFuzzy() ? this.state.topicIds() : null, topicId: null, }, queryParamsHandling: 'replace', @@ -106,8 +106,8 @@ export class KeywordsSearchResultsComponent { path: 'patents', queryParams: { keywords: this.state.payload()?.keywords?.join(','), - fuzzy: this.tabFuzzyValue('patents'), - topics: this.tabFuzzyValue('patents') ? this.state.topicIds() : null, + fuzzy: this.currentFuzzy(), + topics: this.currentFuzzy() ? this.state.topicIds() : null, topicId: null, }, queryParamsHandling: 'replace', @@ -119,8 +119,8 @@ export class KeywordsSearchResultsComponent { path: 'works', queryParams: { keywords: this.state.payload()?.keywords?.join(','), - fuzzy: this.tabFuzzyValue('works'), - topics: this.tabFuzzyValue('works') ? this.state.topicIds() : null, + fuzzy: this.currentFuzzy(), + topics: this.currentFuzzy() ? this.state.topicIds() : null, topicId: null, }, queryParamsHandling: 'replace', @@ -132,8 +132,8 @@ export class KeywordsSearchResultsComponent { path: 'news', queryParams: { keywords: this.state.payload()?.keywords?.join(','), - fuzzy: this.tabFuzzyValue('news'), - topics: this.tabFuzzyValue('news') ? this.state.topicIds() : null, + fuzzy: this.currentFuzzy(), + topics: this.currentFuzzy() ? this.state.topicIds() : null, topicId: null, }, queryParamsHandling: 'replace', @@ -145,8 +145,8 @@ export class KeywordsSearchResultsComponent { path: 'trends', queryParams: { keywords: this.state.payload()?.keywords?.join(','), - fuzzy: this.tabFuzzyValue('trends'), - topics: this.tabFuzzyValue('trends') ? this.state.topicIds() : null, + fuzzy: this.currentFuzzy(), + topics: this.currentFuzzy() ? this.state.topicIds() : null, topicId: null, }, queryParamsHandling: 'replace', @@ -156,7 +156,9 @@ export class KeywordsSearchResultsComponent { return links; }); - private readonly lastUserFuzzy = signal(false); + private currentFuzzy(): boolean { + return this.route.snapshot.queryParamMap.get('fuzzy') === 'true'; + } readonly selectedKeywordCount = computed(() => this.state.keywords().length); readonly allKeywordEntries = computed(() => { @@ -198,15 +200,6 @@ export class KeywordsSearchResultsComponent { }); } - // the Fuzzy Search toggle is locked on while the Personen tab is active - isPersonsTab(): boolean { - return this.route.snapshot.firstChild?.routeConfig?.path === 'persons'; - } - - tabFuzzyValue(path: string): boolean { - if (path === 'persons') return true; - return this.lastUserFuzzy(); - } goBackToSearch(): void { void this.router.navigate(['/keywords'], { queryParamsHandling: 'merge', -- 2.56.1