fixed wrong fuzzy search toggler behaviour on navigating #303
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user