ngrx

typescript: How to get objects with the same property values but different keys from 2 different sets of Objects

别说谁变了你拦得住时间么 提交于 2020-03-25 18:39:57
问题 I have to sets of Json got from the form the state data objetSet1: {id: 12, name: 'Foo Bar', email: 'foo@bar.com'}, {id: 23, name: 'Bar Foo', email: 'bar@foo.com'}, {id: 61, name: 'Barbell', email: 'barbell@mail.com'}, {id: 45, name: 'Joe Ocean', email: 'joe@ocean.com'} objectSet2: {ObjectId:15, name: 'someone', email: 'someone@mail.com'}, {ObjectId: 23, name: 'sometwo', email: 'sometwo@mail.com'}, {ObjectId: 72, name: 'seven ', email: 'seven@mail.com'}, {ObjectId: 23, name: 'five ', email:

RxJs/NgRx - is there a way to “Cancel” a stream after the delay operator

烂漫一生 提交于 2020-03-20 19:41:32
问题 I am using a polling scheme in my Angular application using NgRx. To simplify things, I have something like the following... public stopPolling$ = createEffect(() => this.actions$.pipe( ofType(actions.stopPolling), tap(_ => this.isPollingActive = false), map(_ => actions.stopPolling()) ), { dispatch: false }); public continuePolling$ = createEffect(() => this.actions$.pipe( ofType(actions.getData), tap(_ => this.logger.debug('continue polling')), delay(8000), switchMap(_ => this.pollData()) )

RxJs/NgRx - is there a way to “Cancel” a stream after the delay operator

别来无恙 提交于 2020-03-20 19:39:32
问题 I am using a polling scheme in my Angular application using NgRx. To simplify things, I have something like the following... public stopPolling$ = createEffect(() => this.actions$.pipe( ofType(actions.stopPolling), tap(_ => this.isPollingActive = false), map(_ => actions.stopPolling()) ), { dispatch: false }); public continuePolling$ = createEffect(() => this.actions$.pipe( ofType(actions.getData), tap(_ => this.logger.debug('continue polling')), delay(8000), switchMap(_ => this.pollData()) )

RxJs/NgRx - is there a way to “Cancel” a stream after the delay operator

馋奶兔 提交于 2020-03-20 19:39:25
问题 I am using a polling scheme in my Angular application using NgRx. To simplify things, I have something like the following... public stopPolling$ = createEffect(() => this.actions$.pipe( ofType(actions.stopPolling), tap(_ => this.isPollingActive = false), map(_ => actions.stopPolling()) ), { dispatch: false }); public continuePolling$ = createEffect(() => this.actions$.pipe( ofType(actions.getData), tap(_ => this.logger.debug('continue polling')), delay(8000), switchMap(_ => this.pollData()) )

RxJs/NgRx - is there a way to “Cancel” a stream after the delay operator

余生长醉 提交于 2020-03-20 19:35:25
问题 I am using a polling scheme in my Angular application using NgRx. To simplify things, I have something like the following... public stopPolling$ = createEffect(() => this.actions$.pipe( ofType(actions.stopPolling), tap(_ => this.isPollingActive = false), map(_ => actions.stopPolling()) ), { dispatch: false }); public continuePolling$ = createEffect(() => this.actions$.pipe( ofType(actions.getData), tap(_ => this.logger.debug('continue polling')), delay(8000), switchMap(_ => this.pollData()) )

angular: ngrx effects not firing

余生长醉 提交于 2020-03-19 06:19:52
问题 I've worked on a few Angular apps that implemented Redux (NgRx). I can't figure out my current project's issue. Actions: export class GetUserFromStorage implements Action { readonly type = UserActionTypes.GetUserFromStorage; } export class GetUserFromStorageSuccess implements Action { readonly type = UserActionTypes.GetUserFromStorageSuccess; constructor(public payload: User | null) { } } export class GetUserFromStorageFail implements Action { readonly type = UserActionTypes

catchError cancel all parallel requests

狂风中的少年 提交于 2020-03-04 17:37:27
问题 I made multiple requests in parallel. then I throw error when timeout. getAllDirections() { ... return from(urls).pipe( // a list of api urls mergeMap((urlParam, index) => this.http.get<ISchedules>(urlParam[0]).pipe( map(dataRes => { return dataRes; }), timeout(6000), catchError(error => { console.log(error); return throwError(`Request timeout ${error}`); }) ) ) ); Then in my effect I capture the error $LoadSchedulingsByDirectionsByBranch = createEffect(() => this.actions$.pipe( ofType<any>

catchError cancel all parallel requests

雨燕双飞 提交于 2020-03-04 17:37:13
问题 I made multiple requests in parallel. then I throw error when timeout. getAllDirections() { ... return from(urls).pipe( // a list of api urls mergeMap((urlParam, index) => this.http.get<ISchedules>(urlParam[0]).pipe( map(dataRes => { return dataRes; }), timeout(6000), catchError(error => { console.log(error); return throwError(`Request timeout ${error}`); }) ) ) ); Then in my effect I capture the error $LoadSchedulingsByDirectionsByBranch = createEffect(() => this.actions$.pipe( ofType<any>

How do you detect NgRx createAction duplicate types

不羁岁月 提交于 2020-03-03 10:19:46
问题 When using copy and paste to add new actions in NgRx, it is sometimes possible to forget to change the action type that is a plain string. Sure, making it a static static var makes it less likely, but still possible. How do you detect this oversight? It can cause weird bugs that are hard to track down at runtime and seems to be something that is easier to avoid at compile time. For example, these will cause an issue at runtime, without any warnings at compile time export const meeting_user

Chain Actions in an Effect in @ngrx

非 Y 不嫁゛ 提交于 2020-02-28 04:32:31
问题 I am having some trouble chaining actions one after the other in an Effect that makes an HTTP-request. Here's the Effect code: export class UserEffects { @Effect() update$: Observable<Action> = this.actions$.ofType(user.USERCHANGE).pipe( switchMap(data => this.authService.login(data['payload'])), map(userInfo => new UserChangedAction(userInfo)), tap(() => this.store.dispatch( new LoginStateChangeAction(localStorage.getItem('token'))) ) ); constructor(private authService: AuthService, private