I have a method for dispatching an action to query and select the account. I am unsure if this is the most efficient approach for selecting the data post-dispatch.
this._store.dispatch(AccountsPageActions.loadAccountWithDetails({ accountId: this._accountId }));
this.account$ = this._actionsSubject.pipe(
filter(action => action.type === AccountsApiActions.loadAccountWithDetailsSuccess.type),
switchMap(() => this._store.select(getAccountDetailById(this._accountId)).pipe(
tap(account => {
this.account = account;
this.accountId = this._accountId;
this._reportsService.setAccount(account);
})
))
);
Does anyone have suggestions on a better practice for accomplishing this task, or is this method acceptable?