Why must must ngrx / redux effects return actions? Is using a noop action like elm considered bad practice?

By default, an ngrx/effect dispatches an action. If you want an effect to be ‘fire-and-forget’, all you need to do is add {dispatch: false} as an argument to the @Effects() decorator. From the @ngrx/effects docs: Observables decorated with the @Effect() decorator are expected to be a stream of actions to be dispatched. Pass { dispatch: … Read more

How to wait for 2 Actions in @ngrx/effects

I am new to RXJS but what about this. You can remove {dispatch: false} if you change the tap to a switchMap. @Effect({dispatch: false}) public waitForActions(): Observable<any> { const waitFor: string[] = [ SomeAction.EVENT_1, SomeAction.EVENT_2, SomeAction.EVENT_3, ]; return this._actions$ .pipe( ofType(…waitFor), distinct((action: IAction<any>) => action.type), bufferCount(waitFor.length), tap(console.log), ); }

Angular 2+/4/5/6/7: Smart, dumb and deeply nested component communication

(UPDATE: 02-07-2019: This post was getting dated–added the ‘store/ngrx’ pattern) So after looking into this further, when it comes to how best to communicate down and up a nested component chain, there seems to be really only two options — a Faustian bargain between: EITHER either pass @Input/@Output bindings up, down, and throughout the nested … Read more

NullInjectorError: No provider for ReducerManager

Managed to solve this by adding StoreModule.forRoot({}), in the imports. StoreModule.forRoot should only be called once in the root of your project NgModule. If you wan’t to register a feature, use StoreModule.forFeature. Using forRoot registers the global providers needed for Store. Check the github discussion here on this issue. The above reason was stated in … Read more

Catch error in combined pipe of pipeable rxjs operators

After refactoring you moved map out of switchMap projection, so any error will close the outer stream. To keep both streams equivalent, you need to use pipe in the projection itself like that: import { EMPTY } from ‘rxjs’; // … @Effect() loadData$ = this.actions$ .ofType(LOAD_DATA) .pipe( map((action: LoadData) => action.payload), withLatestFrom(this.store.select(getCultureCode)), switchMap(([payload, cultureCode]) => … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)