1
我的应用程序使用ngrx和ngrx效果。这里是我的应用程序的影响之一:链接RxJS映射运算符和ngrx效果问题
@Effect()
reloadPersonalInfo$: Observable<Action> = this.actions$
.ofType(currentUserAccount.ActionTypes.RELOAD_PERSONAL_INFO)
.filter(() => <boolean>JSON.parse(localStorage.getItem('authenticated')))
.switchMap(() =>
this.userAccountService
.retrieveCurrentUserAccount()
.map(currentUserAccount => new LoadUserAccountAction(currentUserAccount))
.map(() => new SigninAction())
);
我很奇怪,为什么LoadUserAccountAction
没有进入我的减速功能,如果我注释掉//.map(() => new SigninAction())
任何人都可以请帮助除?我错了什么?
效果意味着只返回一个动作。 – Jim
@Jim:感谢您的评论和编辑。你能否建议一种方法来改变应用程序的设计,以避免返回几个效果的行动? – balteo
您正试图同时返回“LoadUserAccountAction”和“SigninAction”。你应该返回其中一个。换句话说,删除代码中的一行.map行。 – Jim