Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 07:50
    timdeschryver commented #3383
  • 06:38
    suke commented #3383
  • May 27 22:58
    mauromattos00 edited #3439
  • May 27 22:38
    mauromattos00 edited #3439
  • May 27 22:37
    mauromattos00 edited #3439
  • May 27 22:29
    netlify[bot] commented #3439
  • May 27 22:25
    netlify[bot] commented #3439
  • May 27 22:25
    mauromattos00 synchronize #3439
  • May 27 21:23
    netlify[bot] commented #3432
  • May 27 21:20
    brandonroberts review_requested #3432
  • May 27 21:20
    netlify[bot] commented #3432
  • May 27 21:19
    brandonroberts synchronize #3432
  • May 27 21:19

    brandonroberts on cs-hooks-check

    chore: fix review feedback items (compare)

  • May 27 21:01
    brandonroberts commented #3434
  • May 27 20:24
    netlify[bot] commented #3440
  • May 27 20:20
    netlify[bot] commented #3440
  • May 27 20:20
    markostanimirovic labeled #3440
  • May 27 20:20
    markostanimirovic labeled #3440
  • May 27 20:20
    markostanimirovic opened #3440
  • May 27 19:37
    mauromattos00 commented #3434
Alex
@alexandrupintilei
@this-is-me:matrix.org have you worked with charts? can you recommend me a good library?pls
Andreas Weinzierl
@this-is-me:matrix.org
[m]
I have, but not to the degree that I can give recommendations about them
Alex
@alexandrupintilei
ngx-chart or ngx-echarts?
Andreas Weinzierl
@this-is-me:matrix.org
[m]
No
Alex
@alexandrupintilei
then?
Andreas Weinzierl
@this-is-me:matrix.org
[m]
As said, can't give any recommendation anyways
Alex
@alexandrupintilei
ok
an·ti·he·ro 🍌
@denisonluz_twitter

Question about ngrx Entity:
how to use the selectedId property?

Do I need to set it manually ?meaning I need to dispatch an Action to setUser for example... and set the user id ?

OR does it come with a method to do this? like setOne or addOne?
Joshua Reilly
@jreilly-lukava
What tools do people use for visualizing their Actions->Effects->Reducers? I sometimes find myself getting lost :)
Andreas Weinzierl
@this-is-me:matrix.org
[m]
Implicitly using the dev tools:
You see the actions and changes of actions there:
  1. action fires
  2. Action possibly triggers effects that trigger actions again
  3. Each action has a change which is done by the reducers
Joshua Reilly
@jreilly-lukava
I'm a little stumped on something, maybe someone can point me in the right direction. I want to have an effect that of course fires when a specific action is dispatched, in it I want to retrieve an array of strings from state (with concatLatestFrom probably?), then for each string I want to make an api call and return a success action, and finally only after that is complete I want to dispatch a final action. Does this sound reasonable?
Andreas Weinzierl
@this-is-me:matrix.org
[m]
kind of reasonable, depending on your goal. If you don't need the intermediate actions you could just do all API calls in the effect at once and then dispatch the final action - but you have to know what makes sense
Nikolai Paul
@nikolaipaul
Hey, what does "Navigation Action Timing" mean? If you want the ROUTER_NAVIGATION to be dispatched after guards or resolvers run, change the Navigation Action Timing.
Here: https://ngrx.io/guide/router-store/actions <- RouterNavigationAction
Nikolai Paul
@nikolaipaul
ah found it. it's a configuration that one can provide
Michael
@CodeTropolis
Hello all, I want to assign the result of an action to an observable (BehaviorSubject) and use the async pipe for the observable in the template (this is setup in the template). As it is, I'm getting back nested objects. I want an array of objects. Please see line 35 here: https://stackblitz.com/edit/angular-rfffqe-vtjlhn?file=src%2Fapp%2Fapp.component.ts. Thus I shouldn't need to subscribe, but would like to catchError (need help here too). Looks like I'm getting the right response from my effect.
Hemang Kumar
@hemang_kumar:matrix.org
[m]

Hey everyone, I've a question about setting up ngrx/schematics (using npm link) locally to work on a bug. I'm trying to solve an issue with the "feature" schematic. A bit stuck with the local setup and need your help 🙏 .

Here's my local setup,

Folder structure:

ngrx-schematics-fix/
  - platform/  - Cloned the repo here
  - platform-playground/ - New angular project

I ran npm link in platform/modules/schematics, followed by npm link @ngrx/schematics and npm i @ngrx/schematics in the platform-playground directory.

This installed the local copy of plugin in the playground angular project.

But when I try to use a schematic now, I get a "Cannot found module" error:

➜  platform-playground git:(master) ✗ ng generate feature dashboard/store/Dashboard -m dashboard/dashboard.module.ts --group   

An unhandled exception occurred: Cannot find module '/Users/hemang/projects/ngrx-schematic-fix/platform/modules/schematics/src/feature'
Require stack:
- /Users/hemang/projects/ngrx-schematic-fix/platform-playground/node_modules/@angular/cli/models/schematic-engine-host.js
- /Users/hemang/projects/ngrx-schematic-fix/platform-playground/node_modules/@angular/cli/models/schematic-command.js
- /Users/hemang/projects/ngrx-schematic-fix/platform-playground/node_modules/@angular/cli/commands/generate-impl.js
- /Users/hemang/projects/ngrx-schematic-fix/platform-playground/node_modules/@angular-devkit/schematics/tools/export-ref.js
- /Users/hemang/projects/ngrx-schematic-fix/platform-playground/node_modules/@angular-devkit/schematics/tools/index.js
- /Users/hemang/projects/ngrx-schematic-fix/platform-playground/node_modules/@angular/cli/utilities/json-schema.js
- /Users/hemang/projects/ngrx-schematic-fix/platform-playground/node_modules/@angular/cli/models/command-runner.js
- /Users/hemang/projects/ngrx-schematic-fix/platform-playground/node_modules/@angular/cli/lib/cli/index.js
- /usr/local/Cellar/nvm/0.37.2/versions/node/v16.7.0/lib/node_modules/@angular/cli/lib/init.js
- /usr/local/Cellar/nvm/0.37.2/versions/node/v16.7.0/lib/node_modules/@angular/cli/bin/ng
See "/private/var/folders/0z/dklrs6s14zl89vq7gj585mz00000gn/T/ng-j5OyDb/angular-errors.log" for further details.

I do have @ngrx/schematics set as the defaultCollection in angular.json. The package.json looks like,

"dependencies": {
    "@angular/animations": "~12.2.0",
    "@angular/common": "~12.2.0",
    "@angular/compiler": "~12.2.0",
    "@angular/core": "~12.2.0",
    "@angular/forms": "~12.2.0",
    "@angular/platform-browser": "~12.2.0",
    "@angular/platform-browser-dynamic": "~12.2.0",
    "@angular/router": "~12.2.0",
    "rxjs": "~6.6.0",
    "tslib": "^2.3.0",
    "zone.js": "~0.11.4"
},
"devDependencies": {
    "@angular-devkit/build-angular": "~12.2.2",
    "@angular/cli": "~12.2.2",
    "@angular/compiler-cli": "~12.2.0",
   ** "@ngrx/schematics": "file:../platform/modules/schematics",**
    "@types/jasmine": "~3.8.0",
    "@types/node": "^12.11.1",
    "jasmine-core": "~3.8.0",
    "karma": "~6.3.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.0.3",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "~1.7.0",
    "typescript": "~4.3.5"
}
1 reply
Joshua Reilly
@jreilly-lukava

I have an issue I'm hoping someone might be able to help me resolve. I think I read someplace that effects are executed in the order they are registered in the EffectsModule.forFeature/Root. However, how does this work when I need effects from feature2 to run first and then effects from feature1?

My scenario is this. Upon signout I need to make some apis using jwts stored in auth state. So obviously I can't have the auth state reset until that is done. I was hoping there was a way to do this without having add complicated checks in the signout effect to see if the "clean" up effects have finished running. Any suggestions?

Andreas Weinzierl
@this-is-me:matrix.org
[m]
Launch an action signaling completion of the API requests in the "first" effect, and launch an effect based on that action that resets the auth state
Tiago Magalhães
@tiagomsmagalhaes

I am getting an "infinite loop" when subscribing to this selector

export const sortAndFiltering = createSelector(
    invoicesFeature, state => {
        return {sort: state.sort, filter: state.filter};
    }
);

Is it due as I'm always creating a new object with those 2 properties?

Andreas Weinzierl
@this-is-me:matrix.org
[m]
no that's not the cause
Tiago Magalhães
@tiagomsmagalhaes

I got the proper way to do it by doing

export const getInvoiceFiltering = createSelector(
    invoicesFeature, state => state.filter
);

export const getInvoicePageSort = createSelector(
    invoicesFeature, state => state.sort
);

export const sortAndFiltering = createSelector(
    getInvoiceFiltering, getInvoicePageSort, (filter, sort) => {
        return {sort, filter};
    }
);

@this-is-me:matrix.org is it because I'm getting all the state in the previous, and by "funneling" down the slices of the state?

Andreas Weinzierl
@this-is-me:matrix.org
[m]
A selector is only run if it's arguments change (an object with different address but same content is a change);
So do you maybe fire an action based on your subscription, or do you maybe fire actions in your effects that could trigger a change?
Tiago Magalhães
@tiagomsmagalhaes

I have an effect to get invoices but I wanted to trigger a new fetch whenever the filter or sort would change,

It worked fine if I just used getInvoiceFiltering or getInvoicePageSort but as soon as I would use this selector :point_up: September 15, 2021 4:00 PM it would trigger the infinite loop

James Hall
@Jadex1
Hello All, is there a way to prevent a component from re-rendering when a store it is connected to is updated?
I'm also trying to find a explanation of how ngrx and trigger a component to reload
Chi
@roddc
Hi there, is there an option to limit the size of an entity? I am building an app that will fetch data from a websocket, and the size of entity will increase overtime. I want to remove the old items when the size exceeds maximum. I currently use selectTotal$ to get the current size of the entity and if it exceeds maximum, then I will call removeMany(ids) to delete the old items. However, I don't think this is a good way, because the selectTotal$ will be triggered again. Should I do this in reducer when upserting items to the entity?
Mo Moadeli
@momoadeli
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?
Joel Duckworth
@jpduckwo
Hi all, I'm struggling with something that's probably simple but I can't figure it out.
Let's say I have an action that is one of two types. Ie ofType(actionType1, actionType2)
In the result I can check the .type to see which of the types it is...
However, how can I then cast that result as the type it is, rather than just any. This then giving me typed access to the action's props
ofType(Actions.initSuccess, Actions.initFail),
map(action => {
  if (action.type === Actions.initSuccess.type) {
    const something = (action as ?).propertyOnlyExistingOnSuccessType;
  }
})
Knut Schleßelmann
@kschlesselmann
Hi! How are you supposed to handle undefined initial state? Let's say I get a quite complex object from my API after auth but the initial state is undefined until then?
3 replies
Robin (Robert) Thomas
@RobertAKARobin
When are we thinking v13 will be released?
Attoumane
@akuma8

Hi there,
Could someone please explain me this syntax { users } on extracting the payload of an action?

createReducer(  initialState,
  on(myAction, ( state, { users } ) => ( // I don't understant how is that able to extract the payload 
    {
      ...state,
      users: [...users]
    }) 
  )

export const myAction = createAction('[Users] Set Users',
  props<{ users: User[] }>()
);

I am mainly a Java developer that's maybe the reason I am a bit confused.
Thank you

2 replies
Prakashkhadka7
@Prakashkhadka7
The entity passed to the selectId implementation returned undefined.I am getting this warning.
Can anyone help me
Jonathan
@jonathanazulay

I'm learning about share(), and have understood that whenever number of subscribers go to 0 or source complete, it will "restart" the source. This should be configurable with the config passed to share.

As I see it, this should only print "1" once. But it does it for every subscription. Can anyone explain why?

const testObs = rxjs.of(1).pipe(rxjs.operators.share({ resetOnComplete: false, resetOnRefCountZero: false }))
testObs.subscribe(console.log),
testObs.subscribe(console.log)

Tristan Blackwell
@tr1stan

NGRX selectors using the factory method. How do I go about calling one inside another selector when inside a loop? I must be missing something, as this feels like quite a common use case, but I can't find any examples. The problem is I'd normally pass the prop into the factory method during the createSelector call, but in this instance I don't know that value as I need to loop though a bunch of Ids to get each one.

I can sort of get it to work using the below code, but this is returning an array of MemoizedSelector, so the further selection isn't happening:

const selectThingWithMeta = (thingId: number) =>
    createSelector(
        thingA.selectEntityMap,
        thingB.selectEntityMap,
        thingCSelectorThatNeedsThingId(thingId), 
        (
        thingA, 
        thingB, 
        thingC
        ) => {
            return slice of state here
       });

// need this because I don't know the value to pass into the selectThingWithMeta factory of the createSelector method, because this data comes form the array of Ids.
const selectThingWithMetaFactory = () => selectThingWithMeta;

const selectThingsWithMeta = (thingIds: number[]) =>
    createSelector(selectThingWithMetaFactory, (thingSelector) => {
        return thingIds
            .map((thingId) => thingSelector(thingId))
    });
1 reply
JSmithOner
@jsmithoner:matrix.org
[m]
hello not sure how to write fancy messages, but I'm trying to achieve to provide reducers that are asynchronous (indexedDb) to my root module. I've managed to make my app load but the state is not working.Any ideas?.Thanks in advance.
Andreas Weinzierl
@this-is-me:matrix.org
[m]
async meta reducer?
JSmithOner
@jsmithoner:matrix.org
[m]
thanks for your answer I don't know what is a meta reducer but I've maged to make work my reducers using reducerManager (tutorial I've found). but I would like to share the state between all reducers
Andreas Weinzierl
@this-is-me:matrix.org
[m]
I am not aware that this is possible. However you can use meta reducers to access all state and e.g. sync it to local storage.
However, ngrx/platform#1649 and https://stackoverflow.com/questions/55319705/ngrx-asynchronous-meta-reducer suggest that it doesn't work with async calls (and also should not work).
You could use synchronous calls (seems possible with indexeddb) or handle it through effects
JSmithOner
@jsmithoner:matrix.org
[m]
ok many thanks for your answer
Quentin Delettre
@qdelettre
Hi. I'm trying to use ngrx-data.
I can see in redux devtools the query-all action ([team-member] @ngrx/data/query-all) but it never use the data i'm receiving. Any hints to debug that ?
erYasar
@erYasar

Hi how to access the ngrx-component-store in child components?

<parent-component>

<c1></c1>

<c2></c2>
</parent-component>

I have a component-store to load all person, and in child component when access the same store i could not able to get the persons

erYasar
@erYasar
is it possible to use without input decorators at child component. i am assuming myself when i have component store at parent level. it would be available at component tree. so that i can access the data in child component
bno1
@bno1:matrix.org
[m]
hello
i want to do the following thing: have action A that triggers actions B and C. Action B also triggers action Z, but the actions execute in the following order: A, B, C, Z. I want them to execute as A, B, Z, C
Phillip Couto
@phillipCouto
@bno1:matrix.org you need to use an effect to create the correct actions in the order you want
onActionA Effect returns of(actionB(), actionC), then onActionB Effect returns of(actionZ())
If the order is not exactly how you want it you can have an effect to dispatch actionC by responding to actionB then waiting for actionZ before returning actionC