You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi and thank you for your contributions to the open-source community!
I've tried this lib with react-redux^7.2.8 + withInjectedReducers HOC from the README.md and it works great.
Under Module Federation though the same code doesn't work - the getState() call in withInjectedReducers is still seeing the previous state. I have a console.log at inject time and it's injected before the rendering occurs but still in the HOC injectedReducers doesn't have the newly added one.
To note that I'm trying to import a lazy local file (not from a federated module!).
I've read reduxjs/react-redux#1126 but I am out of ideas why that might occur. @Ephem's solution is a bit different and it works I guess because the new slice is generated just in time instead of relying on getState() but I don't want to attach my reducers (or ducks) to a specific component but rather inject them at import time.
Any help appreciated.
The text was updated successfully, but these errors were encountered:
nkalinov
changed the title
withInjectedReducers not working (still seeing previous state)
withInjectedReducers not working with Module Federation (still seeing previous state)
Jun 2, 2022
Ah this repository brings back memory.
Currently I don't have much time to work on it.
But back in the days, before all this mess about hooks, things were far easier.
I would need to dig a lot in the new code to understand what is going on.
Can you provide me some links about Module Federation please? I will have a quick look.
You can find plenty of info on Module Federation on internet.
Otherwise here is a link to a concrete implementation by its initial creator: https://github.com/module-federation/module-federation-examples/tree/master/redux-reducer-injection but I don't (or didn't) want to inject my store as a prop.
I think I'll go with this implementation though so feel free to close this issue if you feel like it.
Hi and thank you for your contributions to the open-source community!
I've tried this lib with react-redux^7.2.8 +
withInjectedReducers
HOC from the README.md and it works great.Under Module Federation though the same code doesn't work - the getState() call in
withInjectedReducers
is still seeing the previous state. I have a console.log at inject time and it's injected before the rendering occurs but still in the HOCinjectedReducers
doesn't have the newly added one.To note that I'm trying to import a lazy local file (not from a federated module!).
I've read reduxjs/react-redux#1126 but I am out of ideas why that might occur.
@Ephem's solution is a bit different and it works I guess because the new slice is generated just in time instead of relying on getState() but I don't want to attach my reducers (or ducks) to a specific component but rather inject them at import time.
Any help appreciated.
The text was updated successfully, but these errors were encountered: