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

Support for newer version of redux / react-redux #8

Closed
mfolnovic opened this issue Jan 16, 2019 · 6 comments
Closed

Support for newer version of redux / react-redux #8

mfolnovic opened this issue Jan 16, 2019 · 6 comments
Assignees

Comments

@mfolnovic
Copy link

This addon works correctly on versions:

    "react-redux": "^5.1.1",
    "redux": "^3.5.2",

But, on versions:

    "react-redux": "^6.0.0",
    "redux": "^4.0.1",

I receive error:
Invariant Violation: Could not find "store" in the context of "Connect(Container)". Either wrap the root component in a <Provider>, or pass a custom React context provider to <Provider> and the corresponding React context consumer to Connect(Container) in connect options.

@frodare
Copy link
Owner

frodare commented Jan 16, 2019

Thank you for letting me know! I will look into this. I think there are some issues switching between storybook 3 and 4 too.

@pkuczynski
Copy link

My team is also affected by this issue :(

@frodare
Copy link
Owner

frodare commented Jan 17, 2019

This looks to be due to the updates to react-redux which starting using the new Context API in React 16.3 I think I have found a solution by requiring the Provider component from react-redux to be passed into the addon builder function for addon-redux.

This would require a change to your decorators file

import { Provider } from 'react-redux'

export const withRedux = (state, actions) => withReduxCore(addons)({
  store, state, actions, Provider
})

This seems clunky to me and I would much prefer to find a "more correct" way to fix this, if one exists. If I don't find something in the next few hours I will release a new build with these changes.

@frodare frodare self-assigned this Jan 17, 2019
@frodare
Copy link
Owner

frodare commented Jan 17, 2019

@mfolnovic @pkuczynski
I just deployed v1.0.0 of addon-redux. Can you please try it out and see if it fixes the problem. I would like to make sure it works before closing this issue. You will need to pass in the Provider now as shown above.

@pkuczynski
Copy link

After upgrading to the new version of the extension all of my stories are gone (with message

No Preview

Sorry, but you either have no stories or none are selected somehow.
Please check the storybook config.
Try reloading the page.

Do I still need to do the change with Provider in decorator?

@pkuczynski
Copy link

I tried with what you said and it works now! Thanks! You should updated docs, as they do not mention nothing about Provider now :)

@frodare frodare closed this as completed Jan 17, 2019
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

No branches or pull requests

3 participants