tur-nr / polymer-redux

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

[Documentation] Notify that element property 'actions' can't be defined when using polymer-redux #55

Closed kristfal closed 7 years ago

kristfal commented 7 years ago

Defining a property named 'actions' on an element overrides the redux actions and results in a 'action does not exist on ' error message. This should be documented as it could cause confusion.

Reproduction:

new Polymer({
      is: 'polymer-element',
      behaviors: [
        Redux.ReduxBehavior
      ],
      actions: {

        setLoading: function(loading) {
          return {
            type: 'LOADING',
            loading: loading
          };
        },

      },
      properties: {

        actions: {
          type: Object,
          value: null
        }

       },

       _onSendTap: function() {
          this.dispatch('setLoading', true); // Returns error action 'setLoading' is not defined
       }
});
tur-nr commented 7 years ago

Thanks. I will look into this, there might be a way to get the actions of the instance before polymer sets them as properties. If not documentation will suffice.