tur-nr / polymer-redux

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

Is `statePath` deprecated with Polymer 3 Support? #140

Open dylangrandmont opened 5 years ago

dylangrandmont commented 5 years ago

Hello,

This is more a question than an issue but I would like to confirm an upgrade step from Polymer 2 to 3 support. I am experimenting with the Polymer 3 branch currently in beta release. https://github.com/tur-nr/polymer-redux/tree/dev/v2.x . My existing components which make use of the statePath API are no longer bound to the redux state. Is the behaviour change below correct and intended? Should this be documented since it is a backwards-incompatible change?

polymer-redux v1.x (does not work with v2.x)

// mySelector is a function using reselect which takes in the redux store as a parameter
import {
  mySelector,
} from ...;

class Component extends ReduxMixin(PolymerElement) {
  static get properties() {
    return {
      mySelectorAsProp: {
        type: Object,
        statePath: mySelector,
      },
    };
  }
}

polymer-redux v2.x

import {
  mySelector,
} from ...;

class Component extends ReduxMixin(PolymerElement) {
  static get properties() {
    return {
    };
  }
  static mapStateToProps(state) {
    return {
      mySelectorAsProp: mySelector(state),
    };
  }
}

Potentially related issue: https://github.com/tur-nr/polymer-redux/issues/126