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

Liform doesn't work with react-redux 6.0 #54

Open
t-works opened this issue Feb 3, 2019 · 3 comments
Open

Liform doesn't work with react-redux 6.0 #54

t-works opened this issue Feb 3, 2019 · 3 comments

Comments

@t-works
Copy link

t-works commented Feb 3, 2019

In react-redux v6 passing the store directly as a prop to a connected component was removed.

When I try to use liform with "react-redux": "^6.0.0" I get the following error:
Uncaught Error: Could not find "store" in either the context or props of "Connect(Form(BaseForm))". Either wrap the root component in a , or explicitly pass "store" as a prop to "Connect(Form(BaseForm))"
I used https://github.com/Limenius/symfony-react-sandbox to test this. The error appears after changing react libraries to more recent versions and running yarn upgrade.
This is what I used in package json:
"dependencies": {
"bootstrap-sass": "^3.3.7",
"classnames": "^2.2.6",
"jquery": "^3.3.1",
"js-yaml": "^3.12.0",
"jwt-decode": "^2.2.0",
"liform-react": "^0.9.0",
"react": "^16.6.3",
"react-dom": "^16.6.3",
"react-helmet": "^5.2.0",
"react-on-rails": "^11.2.1",
"react-redux": "^6.0.0",
"react-router-dom": "^4.3.1",
"redux": "^4.0.1",
"redux-form": "^8.1.0",
"redux-thunk": "^2.3.0"
},

@jav974
Copy link

jav974 commented Apr 4, 2019

Same problem ! Had to switch back to using :

"redux-form": "^7.4.2",
"react-redux": "^5.1",
"connected-react-router": "^5.0"

...

ReactRedux provides <ReactReduxContext.Consumer>{({ store }) => {} }}</ReactReduxContext.Consumer>. Perhaps it should be wrapped arround the FinalForm in Liform ?

I tried to embed the Liform inside the above statement, but the error is thrown inside Liform itself.

@simon6023
Copy link

Hi ! Still having the same problem, did anyone find a solution, beside switching back to an earlier version of redux-form/react-redux ?

@tapetersen
Copy link
Contributor

Having the same problem I found out that the problem is not really liform-react not being compatible but rather that its dependencies are outdated and that causes 2 versions of react-redux to be installed if you have a newer installation specified in package.json (or some other package has as a dependency). I will probably submit a PR but until that is done and accepted the easier solution is to override the dependency-resolution in the top level project either by editing package.lock.json for npm or using https://yarnpkg.com/en/docs/selective-version-resolutions if you are using yarn.

In my case

  ...
  "resolutions": {
    "liform-react/redux-form": "8.2.0",
    "liform-react/react-redux": "7.0.3"
  }
...

in package.json solved it (only works if using yarn)

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

4 participants