updated old code to remove warnings
LocationBasedServices/smartguide/pipeline/head This commit looks good
LocationBasedServices/smartguide/pipeline/pr-dev This commit looks good

This commit is contained in:
Kazgatari
2026-07-06 11:35:53 +02:00
parent 86bced4940
commit 9f03c92bc1
2 changed files with 45 additions and 52 deletions
@@ -75,6 +75,13 @@ type KeywordView = 'llm' | 'topic';
styleUrl: './keywords-search.component.scss',
})
export class KeywordsSearchComponent {
private readonly formBuilder = inject(FormBuilder);
private readonly route = inject(ActivatedRoute);
private readonly router = inject(Router);
private readonly destroyRef = inject(DestroyRef);
private readonly websocketService = inject(KeywordWebSocketService);
private readonly topicsService = inject(TopicsService);
readonly form = this.formBuilder.nonNullable.group({
selectedInputType: 'url' as InputMode,
urlInput: '',
@@ -150,14 +157,7 @@ export class KeywordsSearchComponent {
return buildTopicLegendGroups(topics);
}
constructor(
private readonly formBuilder: FormBuilder,
private readonly route: ActivatedRoute,
private readonly router: Router,
private readonly destroyRef: DestroyRef,
private readonly websocketService: KeywordWebSocketService,
private readonly topicsService: TopicsService,
) {
constructor() {
this.route.queryParamMap.pipe(takeUntilDestroyed()).subscribe(() => {
if (this.isOwnNavigation) {
// This emission is just the router confirming the navigation we
@@ -43,7 +43,6 @@ export interface CompareItem {
@Component({
selector: 'app-uni-trend-parent',
standalone: true,
imports: [
CommonModule,
FormsModule,
@@ -195,55 +194,49 @@ export class UniTrendParentComponent implements OnInit {
}
// Effect: automatically sync checkboxes list whenever input keywords change
effect(
() => {
const kws = this.keywords();
const currentSelections = untracked(() => this.selectedTrendTopics());
const currentActive = untracked(() => this.activeChartTopic());
effect(() => {
const kws = this.keywords();
const currentSelections = untracked(() => this.selectedTrendTopics());
const currentActive = untracked(() => this.activeChartTopic());
if (kws.length > 0) {
// Find existing selections that are still in keywords, or default to all
const validSelections = currentSelections.filter((t: string) =>
kws.includes(t),
);
if (validSelections.length > 0) {
this.selectedTrendTopics.set(validSelections);
} else {
this.selectedTrendTopics.set(kws);
}
// Initialize active chart topic to the first selected topic if empty or invalid
const active = currentActive;
const updatedSelections = untracked(() => this.selectedTrendTopics());
if (!active || !updatedSelections.includes(active)) {
this.activeChartTopic.set(updatedSelections[0] || '');
}
// If comparison list is empty, initialize default institutions dynamically
const currentInsts = untracked(() => this.comparisonInstitutions());
if (currentInsts.length === 0) {
untracked(() => this.initializeDefaultInstitutions());
}
if (kws.length > 0) {
// Find existing selections that are still in keywords, or default to all
const validSelections = currentSelections.filter((t: string) =>
kws.includes(t),
);
if (validSelections.length > 0) {
this.selectedTrendTopics.set(validSelections);
} else {
this.selectedTrendTopics.set([]);
this.selectedTrendTopics.set(kws);
}
},
{ allowSignalWrites: true },
);
// Initialize active chart topic to the first selected topic if empty or invalid
const active = currentActive;
const updatedSelections = untracked(() => this.selectedTrendTopics());
if (!active || !updatedSelections.includes(active)) {
this.activeChartTopic.set(updatedSelections[0] || '');
}
// If comparison list is empty, initialize default institutions dynamically
const currentInsts = untracked(() => this.comparisonInstitutions());
if (currentInsts.length === 0) {
untracked(() => this.initializeDefaultInstitutions());
}
} else {
this.selectedTrendTopics.set([]);
}
});
// Effect: load suggestions when topic or location filters change
effect(
() => {
const topic = this.activeChartTopic();
const countries = this.comparisonCountries();
const regions = this.comparisonRegions();
effect(() => {
const topic = this.activeChartTopic();
const countries = this.comparisonCountries();
const regions = this.comparisonRegions();
untracked(() => {
this.loadTrendSuggestions();
});
},
{ allowSignalWrites: true },
);
untracked(() => {
this.loadTrendSuggestions();
});
});
// Handle initialization and synchronization of URL state
this.route.queryParams.subscribe((params) => {