polymer-redux icon indicating copy to clipboard operation
polymer-redux copied to clipboard

Is `statePath` deprecated with Polymer 3 Support?

Open dylangrandmont opened this issue 6 years ago • 0 comments

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

dylangrandmont avatar Dec 31 '18 16:12 dylangrandmont