Polymer-redux 1.0 + Polymer 2 hybrid mode doesn't expose state + dispatch is unknown
See original GitHub issueIt would be great if Polymer-redux would work not only with pure Polymer 2 (e.g. ES6 class syntax) but also with Polymer hybrid mode.
Right now, for hybrid element with the PolymerRedux
behavior the Redux state isn’t available and calling this.dispatch
causes the following error:
Uncaught TypeError: this.dispatch is not a function
This issue can be replicated by running demo/ready-state.html
after applying PR https://github.com/tur-nr/polymer-redux/pull/86.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Issues · tur-nr/polymer-redux · GitHub
Polymer-redux 1.0 + Polymer 2 hybrid mode doesn't expose state + dispatch is unknown. #87 opened on Jun 13, 2017 by ronnyroeller.
Read more >Polymer 2.0 upgrade guide
Upgrading a large application that uses many custom, reusable elements. When upgrading individual elements, you can choose to upgrade to either hybrid mode...
Read more >Documentation - Polymer Redux - GitHub Pages
Bind store state to properties and dispatch actions from within Polymer Elements. Polymer is a modern library for creating Web Components within an...
Read more >Viewing online file analysis results for 'www.atlanticoline.pt'
Submit malware for free analysis with Falcon Sandbox and Hybrid Analysis technology. Hybrid Analysis develops and licenses analysis tools to fight malware.
Read more >ECMAScript 6 Tools Awesome - DirDev.com
ECMAScript 6 Tools Awesome. Transpilers. Babel - Turn ES6+ code into vanilla ES5 with no runtime; Traceur compiler - ES6 features > ES5....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
So if I understand, in
v1.0.0
PolymerRedux
changed from being a behavior (object) to a mixin (function). There’s not a straightforward way to safely auto-convert mixins back to behaviors due to the waysuper
works in ES6 (i.e., we can providePolymer.mixinBehaviors()
, but notPolymer.makeBehaviorFromMixin()
).That said, with the current construction of the PolymerRedux mixin, it looks possible to do it manually, if that’s a solution for you. I did a proof of concept here: https://glitch.com/edit/#!/brick-raver?path=public/index.html:43:2
Basically, this code adds back the behavior-based interface to the mixin function, such that it can be used as a mixin on classes OR a behavior object in hybrid elements.
It’s a bit brittle/hacky, but something like this might work as a stop-gap solution for folks here.
Alternatively, @tur-nr could just consider factoring the code in the mixin callbacks out into shared functions and provide an option to return a behavior that uses the shared code, to avoid needing to deal with
super
issues. We did something like this forMutableData
vs.MutableDataBehavior
.@kevinpschaaf thank you very much.
@tur-nr could you please add this as a behavior.htm in the project?