NgRX エフェクト バージョン 8.5.1 を使用 - 新しい作成関数を使用すると、エフェクトからの監視可能なストリームに問題があります。
このコードでは、コンソールにエラーが表示されます。You provided 'undefined' where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.
loadAllSeasons$ = createEffect(() => this.actions$.pipe(
ofType(SeasonActions.loadSeasons),
withLatestFrom(this.store.pipe(select(selectIfAllSeasonsLoaded))),
filter(([action, allSeasonsLoaded]) => !allSeasonsLoaded),
mergeMap(() => this.seasonService.getSeasons()),
map(seasons => SeasonActions.loadSeasonsSuccess({seasons}))
));
問題は、アクションのディスパッチがloadSeasonsSuccess正しいタイプを返さないことに関係していると考えたので、その行を次のように変更しました。
map(seasons => this.store.dispatch(loadSeasonsSuccess({seasons})))
ただし、コンパイル エラーType 'Observable<Void>' is not assignable to type 'Observable<Action>...'と同じコンソール エラーが発生します。
allSeasonsLoadedフィルターをではなくに切り替える!allSeasonsLoadedと、コードは正常に実行されますが、明らかにシーズンは取得されません。