#Ngrx SignalStore

29 messages · Page 1 of 1 (latest)

bronze crag
#

i have issue while injecting 2 signalStores in one component : to be clear i have 2 diff modules in in my project , and after migrating my store into the new ngrx signaStore i found myself using a store from A component to the B component but is not calling properly and i don't know if its possible or not

#

heres an example in the picture

timber dagger
#

explain is not calling properly

bronze crag
#

so i have created 2 signal Stores ApporteurStore and ReclamationStore

i have this code snippet :

ngOnInit() {
if (this.apporteurUid !== undefined) { this.ReclamationStore.loadReclamationsApporteur(this.apporteurUid);
}
}

which is calling a methode of reclamation store ( that has uid parameters that is calling from apporteur store )
but when i console.log() the uid that coming from the apporteur store always displays undefined
that is why its not calling properly

timber dagger
#

How is ReclamationStore provided in the current component?

bronze crag
#

ReclamationStore = inject(ReclamationStore);

timber dagger
#

'provided' sorry

bronze crag
#

ohh

timber dagger
#

That's the issue then: by providing it here, it means you are accessing a new instance of the store.
How are these 2 components related?

bronze crag
#

so the issue then in the providing way ?

timber dagger
#

yes

bronze crag
#

do u have any solutions then ?

bronze crag
#

no these 2 stores are not related between them

#

well it was called ( in the old ngrx store ) with selectors

timber dagger
bronze crag
#

sorry , but what 2 components are you talking about

#

i am working on one component

#

with 2 diff stores

timber dagger
bronze crag
#

oh no no ; what i meant is that 2 stores are defined in 2 diff modules and i am calling the store from module A to the module that im working on
if you understand what i mean

timber dagger
#

then you need to provide the store at an upper level, not just the module A.

bronze crag
#

well i am using this line in store defintion

timber dagger
bronze crag
#

i got this

timber dagger
# bronze crag

You need to work on providing a whole content as i can't work on asking details each time: you have an error upon indexOf and some part of your store, i don't know your store, i can't copy text from screenshot you share. Make it easier to help you.