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
I noticed that when configuring Kea as per the installation instructions I ended up with 2 stores in my devtools. After a little digging I noticed that resetContext() is called internally just when including the library.
Based on very minor testing of commenting that line out, things still work as I expect and I only see a single store entry in the devtools.
I don't believe the extra store entry has any negative impacts; however, it was confusing seeing two stores and sometimes I have to manually switch to the actual active store when using the devtools. If there is some internal reason requiring resetContext() to be called simply for importing the library then maybe this side effect could be mentioned in the documentation.
Hey! resetContext has been called when the library is initialized for a while now. However starting with 2.0, we also create a new store by default in it. This is to ease setup of the library, so when you're not using any plugins, you can even skip calling resetContext.
Unfortunately I hadn't considered this devtool case. I'll try to find a solution before 2.2 hits the shelves. Thanks for reporting!
I noticed that when configuring Kea as per the installation instructions I ended up with 2 stores in my devtools. After a little digging I noticed that
resetContext()
is called internally just when including the library.Based on very minor testing of commenting that line out, things still work as I expect and I only see a single store entry in the devtools.
I don't believe the extra store entry has any negative impacts; however, it was confusing seeing two stores and sometimes I have to manually switch to the actual active store when using the devtools. If there is some internal reason requiring
resetContext()
to be called simply for importing the library then maybe this side effect could be mentioned in the documentation.Reproduction Steps
Start with a blank create-react-app
install kea deps `npm install --save kea reselect redux react-redux
require kea in index.js `const {resetContext, getContext} = require('kea');
I'm using require instead of import here to avoid the dead code getting tree shaken
Run app and observe an empty store in redux devtools even though we haven't called
resetContext()
Add call to
resetContext()
before renderRun app and observe 2 stores in the redux devtools
The text was updated successfully, but these errors were encountered: