aruntk / polymer-apollo

🚀 Polymer Apollo Integration
MIT License
78 stars 7 forks source link

Polymer 2.0 mixin #15

Open AndreasGalster opened 7 years ago

AndreasGalster commented 7 years ago

I'm looking at PolymerApollo right now, trying to convert your behavior to 2.0 syntax. Some things to discuss are:

I was thinking doing it like so:

export const PolymerApollo = (superclass, options) => class extends superclass {

And then in the component do this maybe?

class AppShell extends PolymerApolloBehavior(Polymer.Element, apolloClient) {

Please let me know what you think, I'm just learning classes now, so I'm not sure if that makes sense.

Almost got something working, just gotta fix some dependencies in a demo, then I'll push a sample repo with what I have so far.

fwielstra commented 7 years ago

I'm trying to get this to work in Polymer 2 too, but no luck so far;

using the wrapping syntax (class MyElement extends PolymerApolloBehavior(Polymer.Element) {}) gives the error Uncaught TypeError: PolymerApolloBehavior is not a function

Using Polymer.mixinBehaviors([PolymerApolloBehavior, Polymer.Element]) gives the error Uncaught TypeError: Cannot read property '__mixinSet' of undefined.

aruntk commented 7 years ago

@fwielstra Use polymer-apollo@2.0.0-rc.2 . Basic Usage - https://github.com/aruntk/polymer-apollo#usage-in-components

fwielstra commented 7 years ago

I am an idiot and used a wrong version of a polymer component again. Sorry <3