Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple stores configured in Redux Devtools #111

Closed
josephmr opened this issue Jul 21, 2020 · 3 comments · Fixed by #113
Closed

Multiple stores configured in Redux Devtools #111

josephmr opened this issue Jul 21, 2020 · 3 comments · Fixed by #113

Comments

@josephmr
Copy link

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

  1. Start with a blank create-react-app

  2. install kea deps `npm install --save kea reselect redux react-redux

  3. 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

  4. Run app and observe an empty store in redux devtools even though we haven't called resetContext()

  5. Add call to resetContext() before render

  6. Run app and observe 2 stores in the redux devtools

image

@sanchezweezer
Copy link

Same thing

@mariusandra
Copy link
Member

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!

@mariusandra
Copy link
Member

This should be fixed in 2.2.0-rc.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants