Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • Nov 08 14:29
    MrWolfZ closed #69
  • Jul 26 2020 05:47
    amithegde commented #20
  • Jul 26 2020 05:46
    amithegde commented #20
  • Jul 06 2020 09:12
    the0rem commented #20
  • Oct 15 2019 16:45
    johannesjo commented #20
  • Sep 21 2019 04:04
    JimTheMan closed #16
  • May 04 2019 00:15
    felixunivers edited #17
  • Apr 29 2019 21:30
    felixunivers opened #17
  • Apr 10 2019 21:15
    rezord opened #16
  • Jan 31 2019 20:44
    alex-okrushko commented #1511
  • Jan 31 2019 20:21
    brandonroberts edited #1538
  • Jan 31 2019 20:20
    brandonroberts edited #1538
  • Jan 31 2019 20:18
    brandonroberts labeled #1538
  • Jan 31 2019 20:18
    brandonroberts labeled #1538
  • Jan 31 2019 20:18
    brandonroberts opened #1538
  • Jan 31 2019 12:11
    timdeschryver closed #1536
  • Jan 31 2019 12:11
    timdeschryver commented #1536
  • Jan 31 2019 12:08
    timdeschryver closed #1537
  • Jan 31 2019 12:08
    timdeschryver commented #1537
  • Jan 31 2019 11:59
    olefrank commented #1036
Jim Lynch
I don't see anywhere that I can put "distinctUntilChanged" with the "new" ngrx syntax... 🤔
export const selectConnectedAccount = (state: AppState) => state.login
  ngOnInit() {

        map(state => {
          console.log('mapping state header: ', state)
          return selectConnectedAccount(state);          
        filter(val => val !== undefined),
        filter((val: any) => val.currentAccount !== undefined),
        // distinctUntilChanged
          state => {
            if (state.currentAccount) {

              console.log('got new connected address: ', state)
              this.connectedAddress = state.currentAccount;

              // Uncommenting below line causes infinite loop of ngrx actions firing...
              // this.store.dispatch(loadHydrants({ account: this.connectedAddress }))
              console.log('got address, dispatching call for hydrants... ', this.connectedAddress)
              console.log('got empty state: ', state)
export interface AppState {
    login: any;
    hydrants: any;
Jim Lynch
^ can anyone see what's wrong with this code?
Jim Lynch
Seems like I was using a wrong selecting syntax (for 9.2.1 ngrx, at least).
It's working for me with this syntax:
this.store.select(state => selectLoginState(state))
        state => {

            console.log('got some state stuff: ', state)

Yerlin Matu
Hey guys I have a problem while building project with ngrx/effects : Error: node_modules/@ngrx/effects/src/concat_latest_from.d.ts:2:145 - error TS2574: A rest element type must be an array type.
Dixit Bafna
@bab2683 I was able to find the fix the change that is required to fix error for pipe_1.pipeFromArray(...) and that is replace this.store.pipe(select(getValue)) -> this.store.select(getValue)
Frank Sheiness

i'm using angular 12 + ngrx 12.2 + router-store. i have a ItemListComponent that shows a list of items and ItemDetailsComponent that shows details about one item. if i go to the list component and get the list of all items and then from there router.navigate to the Details component e.g. /itemDetails/1 everything works fine using <div *ngIf="item$ | async as item" however, if i navigate directly to the /itemDetails/1 the item details don't show up. in my facade, i have

    selectedItems$ = this.store
            tap(project => {
                if (!project) {
            filter(project => {
                console.log('item: ', item);
                return item !== undefined;

i can see it logging the empty item before it pulls the list and the item with data after

@syndesis it has been quite a while I used router-store, but I could remember that there seemed to be a race condition between the declaration of the effects, and the router events. Basically I was missing actions because the ROUTER events were not caught by the effects on navigating directly to the components as the effects were not loaded at that time. it was about 3 or 4 years ago though, this might have changed, but I would look into this if I were you
Frank Sheiness
i discovered that if i wrap my component in an outer component that uses the store variable | async as Input it works
i don't know why that's different from an outer div on the original component, though
Raineer Dela Rita
hi guys any example for authentification model with spring boot +angular (ngrx)
Just wondering if there is a good way forward for using factory selectors with MockStore#overrideSelector, not that props are deprecated. I cannot seem to find a good fit that works
There exists plenty of documentation to migrate the selector itself, but nothing clear. If anyone has a path I'm quite happy to throw up a docfix PR :)
Hi guys, does ngrx/data worth to use it instead of ngrx?
Matt Erman
@alexandrupintilei Yse....using both data and entities have streamlined everything for us...no actions, reducers, effects or anything else...it just works by looking for the properly named API...it's amazing and has reduced the numbe of lines of code tremendously
if you need to do something customized you can still use all of those things, but you shouldn't need to in most cases
@CodeLiftSleep is it easy to teach newcomers on the app ?
Matt Erman
Highly, highly recommend it...basicaly its like an ORM for the front end
It isn't hard...angular university has a great course on it..I would recommend taking that
basically if you have an entity names car, if you make a getAll call, the API would look for an endpoint named cars
if you are using getById() it would look for an endpoint named car
and it basicaly just works like magic
@BertrandMarechal @CodeLiftSleep this guy explain very well how it works:
consider ngrx/data can you have different slice for each enitity? if you need lets say slice1 state into slice2, can you access it?
@CodeLiftSleep do i need ngrx entity if i will use data?
as i understood ngrx data does not neet reducer, effects etc in order to store data
every time we subscribe to an selector, the current value is emited inmediately after subscription, is there a way to subscribe to a selector but only get the subsequent emitions after the subscription not the current value?
I need to subscribe to a selector observable but only get the values AFTER the subscription. Thanks
Skyler L
I'm using ngrx/data -- what is the best-practice for displaying errors to the user in a HTTP request failed scenario? Does ngrx offer anything out of the box?
Skyler L
I googled around for a snackbar-oriented offering but came up short
Rick van der Meij
any guidance on writing effect tests with concatLatestFrom ?
Mo Moadeli
hi! Is there anything prohibiting us from adding the ngrx forRoot into a module other than app.module? I am aware and have worked extensively with feature states but need to see if forRoot store can be moved into another lazyloaded module instead of app.module.ts. thoughts?

@derekkite, @RoboZoom
Trying to implement @ngrx/entity for the first time. Getting the below error.

core.js:4442 ERROR TypeError: entities is not iterable
at addManyMutably (http://localhost:4200/vendor.js:126898:30)
at setAllMutably (http://localhost:4200/vendor.js:126911:9)
at Object.operation [as setAll] (http://localhost:4200/vendor.js:126833:27)
at http://localhost:4200/main.js:731:88
at http://localhost:4200/vendor.js:235769:26
at combination (http://localhost:4200/vendor.js:234089:37)
at onboardingReducer (http://localhost:4200/main.js:680:12)
at http://localhost:4200/vendor.js:234201:20
at combination (http://localhost:4200/vendor.js:234089:37)
at http://localhost:4200/vendor.js:234986:27

Below is my code snippet.

export interface DataPayload {id: string; name: string;address: string; }

export const getDataAction = createAction('[Get Data] Get data');
export const getDataSuccessAction = createAction('[Get Data] Get data successfully', props<{ data: DataPayload[] }>());

export interface DataState extends EntityState<DataPayload> {}
export const DataAdapter: EntityAdapter<DataPayload> = createEntityAdapter<DataPayload>({selectId: (data: DataPayload) => data.id});
export const initialDataState: RefCountryState = refCountryAdapter.getInitialState({});

export const dataReducer = createReducer(
on(getReferenceCountrySuccessAction, (state, action) => {
return refCountryAdapter.setAll(action.refCountries, state);

getData$ = createEffect(() =>
mergeMap(() => this.dataService.getData().pipe(
map((response) => {
console.log(response); // Here I am getting the data back as an array - {data: Array(14)}
return getDataSuccessAction( {refCountries});

Any help would be appreciated.

Is it possible to override a feature store initial state through injection token
I try what is described in the documentation, but it doesn't work
Adrian Wang
What are the ways of access rootState from lazy loaded feature module & store?
I'm looking for a good answer to this question, having had some PR push back from a dev: In NgRx, why do we give state initial values over setting to null or undefined?
1 reply
You can set it to undefined or null. But it's always a good idea to set it properly if you can already do it.
Ash McConnell
Hi Folks, for ngrx/component-store is it recommended to put the business logic in the store itself?
Hello guys
I have multiple reducers from the feature module. previously single application. Now we add 1 more page. so we move these into modules in each section.
how to do that
Brian Cerasuolo
Would it be considered a bad practise to mutate derived values from a selector thay transforms store state?