tur-nr / polymer-redux

Polymer bindings for Redux.
https://tur-nr.github.io/polymer-redux
MIT License
440 stars 67 forks source link

Polymer-2 Mixins - actions not found #66

Closed rkief closed 7 years ago

rkief commented 7 years ago

Everything was working fine before the recent change to the mixins. I am using multiple reducers, thunk, and logger. I was going to test reselect today so I updated to the most recent changes 03/20/17.

I had used: class AppShell extends ShellActions(ReduxMixin(Polymer.Element)) { with const ShellActions = superclass => class extends superclass {

Now based on the demo it should be: class AppShell extends ShellActions(Polymer.Element) { with ShellActions = Parent => class ShellActions extends ReduxMixin(Parent) {

My redux store is:

I cannot get the new changes to work. The error is: Uncaught TypeError: PolyerRedux: has no actions defined. at HTMLElement.dispatch (polymer-redux.html:210) at HTMLElement._routePageChanged (app-shell.html:193) at Object.runMethodEffect [as fn] (property-effects.html:900) at runEffectsForProperty (property-effects.html:127) at runEffects (property-effects.html:100) at HTMLElement._propertiesChanged (property-effects.html:1735) at HTMLElement._flushProperties (property-accessors.html:443) at HTMLElement._flushProperties (property-effects.html:1629) at runNotifyEffects (property-effects.html:223) at HTMLElement._propertiesChanged (property-effects.html:1738)

Would you please lend some guidance on mixins? There is a typo of PolyerRedux in the error. Thank you for putting this together.

rkief commented 7 years ago

Made this change to get the mixins to work as originally set up. Not the solution but _reduxActions was not returning anything. //var actions = this._reduxActions; var actions = collect(this.constructor, 'actions'); Went back to the polymer documentation for multiple mixins. "You can apply multiple mixins in sequence: class AnotherElement extends AnotherMixin(MyMixin(Polymer.Element))"

tur-nr commented 7 years ago

I'm curious, the two setups seem the same. Could you provide more code samples please as you may have uncovered an underlying issue with how PolymerRedux uses Mixins.

rkief commented 7 years ago

I started with "polymer init polymer-2-starter-kit" and added redux to it. Working on publishing files to github but here is what I am playing with. polymer-redux.zip

tur-nr commented 7 years ago

Awesome, got the issue. Binding needs to happen before we call super.connectCallback()