I have 3 signals. All of them are needed to fetch wiki items. My current approach is to define an effect in the constructor of the component which checks if all the signals have a value and if so, fetch the wiki items:
constructor(
private activatedRoute: ActivatedRoute,
private adminService: AdminService,
private authService: AuthService,
private languageService: LanguageService,
private navigateService: NavigateService
) {
effect(() => {
if (!this.wikiBaseUrl() || !this.selectedLanguage() || !this.categoryUuid())
return;
this.fetchWikiItems()
})
}
The fetchWikiItems() function gets the items via a HTTP call and assigns the response to a wikiItems variable.
This works but I have a feeling that this may be bad practice. Is this the correct use case of signals / effects or should I change my approach entirely?