Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Nov 08 2022 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
matrixbot
@matrixbot
Andreas Weinzierl then you should get an error if you return trash
Gianfabio Pezzolla
@gianfabiopezzolla

Hi there I have this effect:

loadTasks$ = createEffect(() =>
    this.actions$.pipe(
      ofType(fromTasksAction.loadTasks),
      withLatestFrom(this.store.select(selectTasks)),
      mergeMap(() =>
        this.tasksService.getPotOwnersTasks().pipe(
          map(tasks => fromTasksAction.loadTasksSuccess({ tasks })),
          // delay(1000),
          // repeat(),
          catchError(error => of(fromTasksAction.loadTasksFailure({ error })))
        )
      )
    )
  );

in my component.ts I call this effect with:

  ngOnInit(): void {
    this.store.dispatch(loadTasks());
    this.loadTasks();

  loadTasks() {
    this.tasks$ = this.store.pipe(shareReplay(1), select(selectTasks));
  }

so my store is:

ngrx store

Now I need to fetch the single object from store:

my get in service is:

getTask(containerId, taskInstanceId): Observable<Tasks> {
    const url = this.apiUrl + 'containers/' + containerId + '/tasks/' + taskInstanceId;

    return this.http.get<Tasks>(url, this.options);
  }

How can I loop in store and display the single task from tasks list in store?

thanks a lot

Michał Kwaśniewski
@bd-Kwasniewski

Hello, I have this long lasting question. Is it ok to use one selector as a "prop source" of another
e.g
selector 1 : selectBookById = createSelector(selectBooks, (books, props) => books.filter(book => book.id === props.id))
selector 2 : selectActiveId = crateSelector(selectActiveIdState, (activeIdState) => activeIdState.activeId)

and now

    selectActiveBook  = createSelector(
        booksStateAndActiveIdState => booksStateAndActiveIdState, 
        selectActiveId, 
       (booksStateAndActiveIdState, activeID) => selectActiveId(booksStateAndActiveIdState, {id: activeId})
    )

Elaboration: I find myself often duplicating selectors for specific entity by its ID and also i have selectors for "active" entities e.g. ones that are in url param in given moment
I would like to write ...byId selectors and latter only enhance them with active
is the way above valid ?

cuznerdexter
@cuznerdexter

Does anyone know how or have links for using StoryBook & Angular with NGRX Store ?

I have followed the StoryBook tutorial but still cannot figure out how to use StoryBook with NGRX Store. I can use StoryBook with Angular Dumb Components fine. I need to be able to set the NGRX Store State for the stories of my Nested components.

eg. In my SmartComponent I have:

this.accountDebtor$ = this.coreStore.select( coreSelector.selectAccountDebtorState );

In the Story I have:

export const LoadedAccountPanel = (args) => ({
 component: AccountComponent,
 props: args,
});
LoadedAccountPanel.args = {
 panelData: {},
 accountDebtor$: <-- How do I set the State so this gets set using the store ???,
};
cuznerdexter
@cuznerdexter

Hi all,
Anyone see errors like this after running:
nx update && then npm run audit ??

npm ERR! code ELOCKVERIFY
npm ERR! Errors were found in your package-lock.json, run  npm install  to fix them.
npm ERR!     Invalid: lock file's @ngrx/schematics@10.1.0 does not satisfy @ngrx/schematics@10.0.0
npm ERR!     Invalid: lock file's @ngrx/store-devtools@10.1.0 does not satisfy @ngrx/store-devtools@10.0.0

The actual app works fine - using nx serve

I want to fix the errors so I can run my Jenkins job.
Any advice?

JamesDepret
@JamesDepret
Hi, I have a quick question, I'm storing the scroll distance measured from the top of the screen.
Everytime it changes, it dispatches an action, however, one scroll completly fills my inspector with only that action, is there a way to exclude this specific action from the in browser redux inspector?
nunobotelhokk
@nunobotelhokk
I have a method logout on my authentication service which only clears the user cookies. Since i'm using this service method on my effects, it's expecting to return an observable. What can i do here? Just return of() ?
5 replies
Raineer Dela Rita
@raineer24
hi
MNasty
@MNasty75_twitter
Having an issue using ngrx data/ ngrx entities where I get TypeError: entities.reduce is not a function...any idea where the problem is?
Raineer Dela Rita
@raineer24
good evening :)
Mike Herbert
@mherbert71_twitter
Hello. Does anyone know how to hook-into the ngrx bootstrap life-cycle? I’d like to know when ngrx (state, effects, reducers) has been initialized. thoughts anyone?
2 replies
zoinho
@zoinho
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. export declare function concatLatestFrom<T extends Observable<unknown>[], V>(observablesFactory: (value: V) => [...T]): OperatorFunction<V, [V, ...{ [i in keyof T]: ObservedValueOf<T[i]>; }]>;
installed : "@ngrx/effects": "11.1.1", does anybody know what is going on ?
Mugiwara no Lid3
@Lid3tv_twitter
Hi guys, i've a problem with this error : TypeError: Cannot freeze array buffer views with elements I don't know why i can't push on my reducer array ?
paul-carnovale
@paul-carnovale
@zoinho I am getting the same error after upgrading to rxJS 7. I had to downgrade to rxjs 6.6.3 and it started working again. Looks like the effects library will have to be updated before we can upgrade our own apps to rxJS 7.
Zlati Pehlivanov
@talamaska
Hi, is there a way to turn on and off StoreDevtoolsModule on runtime from initializer value or something?
Dixit Bafna
@Dixit199213bafna
@bab2683 Where you able to find the fix for pipe_1.pipeFromArray(...) is not a function?
Braulio
@bab2683
@Dixit199213bafna didn't find a solution per se, but it was caused by a misconfiguration on my store, try double-checking everything, it could be even a typo
Rick van der Meij
@rickvandermey

still active community here? question about entityAdapter,
it seems like deeper object key data is overwritten completely instead of concat, what i would expect.
if this is my entity:

'93dd0fd6-fd8c-4c70-a213-cb76d1ef6eda': {
            guid: '93dd0fd6-fd8c-4c70-a213-cb76d1ef6eda',
            languageSettings: {
                DE: {
                    slug: 'velows',
                },
                EN: {
                    slug: 'velows',
                },
                FR: {
                    slug: 'velows',
                },
                NL: {
                    slug: 'veluwe',
                },
            },
        },

and i update the object with a specific language for content like

```
'93dd0fd6-fd8c-4c70-a213-cb76d1ef6eda': {
            guid: '93dd0fd6-fd8c-4c70-a213-cb76d1ef6eda',
            languageSettings: {
                EN: {
                    slug: 'velows',
                    title: 'Testing EN',
                    content: 'Test',
                },
            },
        },

How do i concat with the entityAdapter?

Jim Lynch
@JimLynchCodes
Hi, I am having massive issues with NGRX
https://stackoverflow.com/questions/66592750/ngrx-unrelated-select-firing-when-updates-another-slice-of-state
^ basically this exact thing is happening to me.
Unrelated selectors are firing when I change a different slice of the app state...
I don't see anywhere that I can put "distinctUntilChanged" with the "new" ngrx syntax... 🤔
export const selectConnectedAccount = (state: AppState) => state.login
  ngOnInit() {

    this.store
      .pipe(
        map(state => {
          console.log('mapping state header: ', state)
          return selectConnectedAccount(state);          
        }),
        filter(val => val !== undefined),
        filter((val: any) => val.currentAccount !== undefined),
        // distinctUntilChanged
        )
        .subscribe(
          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)
            }
            else 
              console.log('got empty state: ', state)
        }
      )
  }
export interface AppState {
    login: any;
    hydrants: any;
}
Jim Lynch
@JimLynchCodes
^ can anyone see what's wrong with this code?
Jim Lynch
@JimLynchCodes
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))
      .subscribe(
        state => {

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

        }
)
Yerlin Matu
@YerlinMatu
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
@Dixit199213bafna
@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
@syndesis

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
        .pipe(select(ItemsSelectors.getSelected))
        .pipe(
            tap(project => {
                if (!project) {
                    this.loadAllItems();
                }
            }),
            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

BertrandMarechal
@BertrandMarechal
@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
@syndesis
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
@raineer24
Hi
aymenbraiek
@aymenbraiek
hi guys any example for authentification model with spring boot +angular (ngrx)
Mark
@bhalash
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 :)
Alex
@alexandrupintilei
Hi guys, does ngrx/data worth to use it instead of ngrx?
Matt Erman
@CodeLiftSleep
@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
BertrandMarechal
@BertrandMarechal
@CodeLiftSleep is it easy to teach newcomers on the app ?
Matt Erman
@CodeLiftSleep
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
etc
and it basicaly just works like magic
Alex
@alexandrupintilei
@BertrandMarechal @CodeLiftSleep this guy explain very well how it works:
https://www.youtube.com/watch?v=TenetyDn4XM&ab_channel=ApplicableProgramming
consider ngrx/data can you have different slice for each enitity? if you need lets say slice1 state into slice2, can you access it?
Alex
@alexandrupintilei
@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