Closed macklay closed 4 years ago
You're going to have to give me more context around the problem you're trying to solve here as the structure you're looking for is not intuitive to the underlying component structure so MyComponent
won't be able to resolve the state for one of the modules if you do that.
Unless you want MyComponent
's view of the store to include both module keys as well, in which case you probably don't want 2 layers of dynamic
involved.
Finally, removing subspaced
and using the non-subspace version of attachReducer
and runSaga
should give you that structure (i.e. all dynamic
things end up in the root), but you will need to handle the state resolution in your component yourself (i.e. they will not be subspaced and the connect
will receive the root state).
I think, I found solution. If I pass context in subspace in this way it works:
dynamic(
moduleName,
subspaced({ subspaceOptions: { context: { parent: context } } }),
attachReducer(reducer),
runSaga(saga),
{ context },
),
Unfortunately current dynostore version is not support subspaceOptions parameter. I tried to make pull request with this ability(https://github.com/ioof-holdings/redux-dynostore/pull/237) but now I dont have free time to make it in more appropriate way.
v3.1.0
. Please try it out and let me know how you go. I'll close this for now, but if you have issues we'll reopen it and work through it.
Now I get such store structure: store: { module1: { module2: {...} } } but I need something like this: store: { module1: {...} module2: {...} }