I'm currently implementing a feature that "open a snackbar"(effect),if close snackbar with action then "open a dialog"(effect) and finally make an API call(effect) after the dialog close.
I want to implement this feature in Component Store,
openDialog = this.effect((trigger$) =>
trigger$.pipe(
exhuastMap(() => this.dialog.open(comp).afterClosed().pipe(
tap((result) => this.callApi(result))))))
snackBar = this.effect((trigger$)=>
trigger$.pipe(
exhuastMap(()=> this.snackBar.open("test","OK").onAction().pipe(
tap(() => this.openDialog())))))
I noticed that the source implementation of effect() will return a subscription, so is calling another effect inside an effect OK or not? If not, I will need to create additional states to trigger above effects or convert some of them into normal function in the service.