Even instantiating here, we miss patches. Is there an official way to do that, am I missing something?
My ideas:
subscribing in onInit itself, however this might be limited as the (lexical) scope/context is limited.
onInit(){
const disposeRootStoreOnInitPatches = onPatches(this, ()=>{
// we can get rid of it and fallback to the original onPatches as shown above
disposeRootStoreOnInitPatches()
}
}
We could introduce a "RootStoreParent" / "RootRootStore".
(But maybe wrong too as RootStores onInit is called before attach/listening?)
const rootStoreParent = new RootStoreParent({})
onPatches(rootStoreParent, ()=>{/*...*/})
// at this point, we have a listener above RootStore
rootStoreParent.instantiateAndAttachRootStore()
Workaround: restrict onInit somehow, so it won't cause any patches to miss?
Assume
RootStore
'sonInit
starts an action.Even instantiating here, we miss patches. Is there an official way to do that, am I missing something?
My ideas:
subscribing in
onInit
itself, however this might be limited as the (lexical) scope/context is limited.We could introduce a "RootStoreParent" / "RootRootStore". (But maybe wrong too as
RootStore
sonInit
is called before attach/listening?)Workaround: restrict
onInit
somehow, so it won't cause any patches to miss?