polymer-redux
polymer-redux copied to clipboard
Polymer 3, lit-element & polymer-redux
Hello!
I'm running into an issue where I get:
Uncaught TypeError: element._setPendingPropertyOrPath is not a function
at bindings.forEach.name (polymer-redux.js:64)
at Array.forEach (<anonymous>)
at update (polymer-redux.js:57)
at bind (polymer-redux.js:83)
at HTMLElement.connectedCallback (polymer-redux.js:151)
at render (lit-html.js:151)
at HTMLElement._propertiesChanged (lit-element.js:134)
at HTMLElement._flushProperties (properties-changed.js:342)
at HTMLElement.ready (properties-changed.js:165)
at HTMLElement.ready (lit-element.js:89)
When I locally hopped in there and changed _setPendingPropertyOrPath to _setPendingProperty (they had similar looking method signatures), it stopped failing/actions worked, but no properties were ever populated from the store.
To reproduce,
- pull down https://github.com/ZempTime/marsfarm-ui/tree/redux
- (as of time of this writing, on this commit: https://github.com/ZempTime/marsfarm-ui/commit/771c2070bc3e512c54f5144ce7bfdf1a505986ab )
npm install && polymer serve
If I'm able to figure out what's going wrong, I will come back and update!
It appears lit-element doesn’t pull in @polymer/polymer/lib/mixins/property-effects.js, it only pulls in @polymer/lib/mixins/properties-mixin.js'.
Gonna attempt a switch to lit-html and see if I can make any headway...
I ended up needing to basically yank out the polymer-redux bit and rewrite portions of it. results here: https://github.com/ZempTime/marsfarm-ui/blob/master/src/mixins/marsfarm-polymer-redux.js
Additionally, because I stopped using the production dist of redux, had to add this to the bottom of my index.html file:
<script>
// TODO: Use production redux bundle (either dist or uglified) later.
// Will either need to integrate loose-envify into build process or
// figure out some other way.
window.process = window.process || {};
process.env = process.env || {};
process.env.NODE_ENV = "development";
</script>
I also think I'll drop the domainConceptMixin (instead of directly using ReduxMixin approach) for a little while and see about that. I ran into issues where I'd accidentally override properties and not realize that was what was causing everything to go crazy.
Specifically, it's impossible to tell what results in the object you're looking at in this line: https://github.com/ZempTime/marsfarm-ui/blob/master/src/mixins/marsfarm-polymer-redux.js#L50 so I think direct is better. If reusability becomes too big a pain I might swap back, though. Being able to get warnings when I override existing properties would be sweet, but that's a js thing.
I'm not sure what to do with this issue/comment, but if you'd like to expand support to people who're gonna be using LitElement then I'd be happy to help!