How to access one mst store from another without #2606
Unanswered
aniket-banyal
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In my application, one field group can contain many fields.
I am using
mst-reference-pool
to store the fields in a pool and use references to prevent duplicating data.The issue I am facing is that on cloning an instance of
ContactFieldGroupModel
, thefields
getter fails because the parent of the cloned node is that node itself rather than theRootStore
.If I could somehow access the root store directly in the
ContactFieldGroupModel
, then the problem would be solved.But, the way ignite boilerplate is set up is it uses useStores hook to get any store.
One solution would be to export the
_rootStore
object as defined here -ignite/boilerplate/app/models/helpers/useStores.ts
Line 17 in 6e8f84a
But, I am not sure if that would be right way to do it.
Beta Was this translation helpful? Give feedback.
All reactions