ngrx-effects

Ngrx effects on lower version of typescript doesn't work

天大地大妈咪最大 提交于 2019-12-12 10:07:40
问题 I have an Ionic 3 App where I use ngrx/store and ngrx/effects. But each time I try to run the app it sais this error below: TypeScript Error A computed property name in a type literal must directly refer to a built- in symbol. ...: Cannot find name 'any'. which refers to this folder in my node modules node_modules/@ngrx/effects/src/on_run_effect.d.ts to this block of code below: export declare function isOnRunEffects(sourceInstance: { [onRunEffectsKey]?: onRunEffectsFn; }): sourceInstance is

Ngrx testing - How to configure TestBed in order to instantiate the entire state store in a test

时光怂恿深爱的人放手 提交于 2019-12-11 13:47:28
问题 I want to run some integration tests for the ngrx 4 state store in an Angular 5 app. My desire is to test dispatching ngrx actions, effects, webapi, mock server and selectors all together in one shot. Writting separate tests for effects and reducers is going to be a time sink and I need to cut some corners. I only need to know when one of my pages fails not the exact spot. I managed to do this in a previous project while using redux together with Angular 2. That was quite easy to setup.

How to guarantee the continuity of observable stream in case of http errors?

北战南征 提交于 2019-12-11 09:50:19
问题 I have a problem with the below method ( onTrySignin ) when I encounter an HTTP error response. The catch block right after my HTTP call prevents the Side Effect from throwing an Action error. if I do console.log I get this error. TypeError: You provided 'undefined' where a stream was expected. You can provide an Observable, Promise, Array, or Iterable. how can I preserve the Observable stream and pass the response to the next block ( mergeMap ) where I can fire other Actions , ( FailedSignin

How is it possible to debug or inspect the ngrx store, actions and effects?

人盡茶涼 提交于 2019-12-10 14:56:42
问题 I am having issues with my application not dispatching some actions or some effects not being called when an action is dispatched (see ngrx effect not being called when action is dispatched from component). I would like to know how to debug the ngrx store, actions and also effects. As the typescript sources for ngrx are not available on my environment (only the typings are available it seems), are there other ways to know what is going on in the store and effects? P.S. It seems the dev store

return subject from inside map

99封情书 提交于 2019-12-10 12:24:42
问题 Asking this as a followup on this (How to return observable from subscribe), as the accepted solution didn't solve my use case Here is my code @Effect() searchQuery$ = this.actions$ .ofType(PlayerSearchActions.SEARCH_NEW_QUERY) .map(toPayload) .withLatestFrom(this.store) .map((latest: any[]) => latest[1]) .do((res)=>{console.log("Starting search with:",res);}) .switchMap((store: MyState) => this.youtubeSearch.resetPageToken() .searchAll(store.search.query, store.search.queryParams) .do((res)=

Is it possible to throw errors inside ngrx-effects without completing the Observable stream?

人盡茶涼 提交于 2019-12-10 10:56:07
问题 Is there any way to use throw with an Error object inside ngrx-effects streams without completing the stream? I've read these great answers on why the stream is being killed by throwing an error: @ngrx Effect does not run the second time ngrx effects error handling https://github.com/ngrx/platform/issues/646 My question is if I'm implementing the Angular ErrorHandler to catch errors, if I'm going to be able to use that with ngrx effects. @Effect() loginUserEffect: Observable<loginActions

Unit testing NgRx effect to ensure the service method was called - ain't working

时光毁灭记忆、已成空白 提交于 2019-12-08 05:08:10
问题 I am using NgRx ^7.0.0 version. This is my NgRx effect class: import { Injectable } from '@angular/core'; import { ApisService } from '../apis.service'; import { Effect, Actions, ofType } from '@ngrx/effects'; import { Observable } from 'rxjs'; import { ApisActionTypes, ApisFetched } from './apis.actions'; import { mergeMap, map } from 'rxjs/operators'; @Injectable() export class ApisEffects { constructor(private apisS: ApisService, private actions$: Actions) { } @Effect() $fetchApisPaths:

Angular2 NGRX Performance Issues On Dispatch?

岁酱吖の 提交于 2019-12-08 03:16:40
问题 I've been working on an application in Angular2/CLI/NGRX and things have been going well until recently. I'm noticing some pretty big spikes in performance especially with consecutive dispatches within the same container. For example lets say I have the following defined: public appEnvironment$: Observable<IEnvironment>; public assessment$: Observable<IAssessment>; public assessmentComments$: Observable<ICommentActivity[]>; public assessmentEvidence$: Observable<IEvidenceActivity[]>; public

ngrx Effects: Are actions dispatched by one effect processed immediately by other effects?

与世无争的帅哥 提交于 2019-12-07 05:40:51
问题 I have an Angular (2) app with four ngrx actions: START Not processed by the reducer (no state change) ngrx Effect calls an async task and maps to SUCCESS or ERROR SUCCESS Processed by the reducer ngrx Effect maps to ADVANCE ADVANCE Not processed by the reducer ngrx Effect navigates to a different route ERROR Processed by the reducer No Effect The problem is that the Effect that catches ADVANCE seems to run before the reducer that processes SUCCESS Here's the Effects code: @Effect() start$ =

Wrap an API function in an RxJs Observable

心不动则不痛 提交于 2019-12-07 02:59:28
问题 I am a newbie to RxJs and I have an API that I am using for geocoding that provides a function like the following: simpleGeocode(options) * where options = { address: {addr: ... }, success: Function, failure: Function}. The success function returns the geocoded LatLon object. I am using this in Angular app with NGRX Effects and so I would like it to have it as an Observable so I can use the standard Effect setup like: @Effect() public calculateLocation: Observable<void> = this.actions .ofType