为什么在使用ngrx效果时会收到此可观察到的警告

mat*_*c19 2 rxjs ngrx angular

我有一个使用ngrx效果的角度应用程序,正在与之一起加载Firestore数据。我目前收到此警告:

您在需要流的地方提供了“()=>({type})”。您可以提供一个Observable,Promise,Array或Iterable。

这是我的NGRX效果

loadVendors$: Observable<Action> = createEffect(() => this.actions$.pipe(
		ofType(fromVendorActions.loadVendors),
		switchMap(() => this.store.select(fromRoot.getRouterState)),
		tap((ev: any)=> console.log('before', ev)),
		switchMap((action:any) => this.vendorService.getVendors(action.state.params.vendorGroupId)),
		tap((ev: any)=> console.log('after', ev)),
		map((vendors: any) => fromVendorActions.loadVendorsSuccess({vendors: vendors})),
		catchError(() => fromVendorActions.loadVendorsFail)
	))
Run Code Online (Sandbox Code Playgroud)

我正在从操作切换,获取我所在页面的参数,然后从服务切换到可观察对象,以检索一些可观察对象的数据。

使用tap()检查流,我似乎得到了期望的结果。警告出现在控制台中,在我记录流的两个(2)抽头之间。数据已正确加载到存储中,但警告困扰着我。

tim*_*ver 5

catchError应该返回一个可观察到的:

catchError(() => of(fromVendorActions.loadVendorsFail))
Run Code Online (Sandbox Code Playgroud)