diff --git a/package.json b/package.json index 40869c3..6a2eed8 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "apollo-client": "^0.5.0" }, "dependencies": { - "lodash.map": "^4.6.0", + "lodash.clone": "^4.5.0", "lodash.omit": "^4.5.0" }, "devDependencies": { diff --git a/src/polymer-apollo.js b/src/polymer-apollo.js index 18687df..d7edf36 100644 --- a/src/polymer-apollo.js +++ b/src/polymer-apollo.js @@ -1,5 +1,6 @@ /* eslint-disable no-param-reassign, func-names, no-console */ import omit from 'lodash.omit'; +import clone from 'lodash.clone'; export class DollarApollo { constructor(el) { @@ -10,7 +11,9 @@ export class DollarApollo { this._subscription = {}; this.attached = false; } - + setEl(el) { + this.el = el; + } get client() { return this.el._apolloClient; } @@ -280,6 +283,7 @@ export class PolymerApollo { } created() { const apollo = this.apollo; + this.$apollo = clone(this.$apollo); if (apollo) { this.$apollo.init(this); } @@ -292,6 +296,7 @@ export class PolymerApollo { } } attached() { + this.$apollo.setEl(this); const apollo = this.apollo; if (apollo && !this.apollo.onReady) { this.$apollo.attached = true;