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

preact-redux 2.1.0 not working with preact-router when passing route values #47

Open
thecodefool opened this issue Jun 14, 2019 · 2 comments

Comments

@thecodefool
Copy link

First I would like to note: PREACT is fantastic, that is why we have put forth great effort to continue using it.

Our app is now lightning fast due to the great work at PREACT, PREACT-REDUX and the PREACT-CLI – keep it up!!.

We had a very similar issue to this so we decided to post an example hoping that the owners of PREACT-REDUX will see it clearly, and have a fast path to remedy.

First I created the “brandnew” app (brandnew.zip) (using preact-cli version 2.2.1)

  • preact create default brandnew

I then created a simple example that would work, DemoIssue and AnotherComponent are the two components that should display what is given in the route parameters when the links Demo 1 or Demo 2 are clicked.

Alas it works :)

Then I added redux to the mix

  • npm install redux --save
  • npm install preact-redux –save
  • npm install preact-context –save (This can be removed later..read on)

This installs preact-redux: “^2.1.0

I then added a simple example of wiring up to redux (Nothing fancy, just a counter to prove it works).

Alas it is broken, hmmmm?

At this point in the app, I could comment out the redux connect in demo-issue.js and simply use the “export default DemoIssue” and it would still work, however we really need redux…

After trial and error we figured out that if we revert to
preact-redux 2.0.3 – NOT preact-redux ^2.0.3 – the app works as expected!!!.

Now that we have gone back to 2.0.3 you can safely remove preact-context as it is no longer a dependency.

Hope that helps in figuring out what is really wrong.

@developit
Copy link
Owner

Thanks for the bug report! It looks like we must have merged an upstream react-redux change that broke this.

Here's a reproduction on CodeSandbox:
https://codesandbox.io/s/preact-redux-47-2kkon

@developit
Copy link
Owner

For those running into this issue: using the official react-redux bindings v5.1.0 (specifically) via preact-compat works fine with Preact 8.x.

For Preact X, any version of the official bindings should work.

kriskuiper added a commit to kriskuiper/frontend-applications that referenced this issue Oct 23, 2019
Was an issue with preact-redux that f*ked up pagination functionality: [issue 1](developit/preact-redux#49)
[issue 2](developit/preact-redux#47) (made me revert)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants