fix: $query
This commit is contained in:
+13
-3
@@ -85,13 +85,23 @@ export class DollarApollo {
|
||||
}
|
||||
|
||||
addSmartQuery (key, options) {
|
||||
options = reapply(options, this.vm)
|
||||
let finalOptions = reapply(options, this.vm)
|
||||
|
||||
const smart = this.queries[key] = new SmartQuery(this.vm, key, options, false)
|
||||
const apollo = this.vm.$options.apollo
|
||||
if (apollo && apollo.$query) {
|
||||
// Also replaces 'undefined' values
|
||||
for (const key in apollo.$query) {
|
||||
if (typeof finalOptions[key] === 'undefined') {
|
||||
finalOptions[key] = apollo.$query[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const smart = this.queries[key] = new SmartQuery(this.vm, key, finalOptions, false)
|
||||
smart.autostart()
|
||||
|
||||
if (!this.vm.$isServer) {
|
||||
const subs = options.subscribeToMore
|
||||
const subs = finalOptions.subscribeToMore
|
||||
if (subs) {
|
||||
if (Array.isArray(subs)) {
|
||||
subs.forEach((sub, index) => {
|
||||
|
||||
@@ -51,10 +51,6 @@ const launch = function launch () {
|
||||
for (let key in apollo) {
|
||||
if (key.charAt(0) !== '$') {
|
||||
let options = apollo[key]
|
||||
// Default options from component
|
||||
if (apollo.$query) {
|
||||
options = Object.assign({}, apollo.$query, options)
|
||||
}
|
||||
// Property proxy
|
||||
if (!options.manual && !hasProperty(this, key) && !hasProperty(this.$props, key) && !hasProperty(this.$data, key)) {
|
||||
Object.defineProperty(this, key, {
|
||||
|
||||
Reference in New Issue
Block a user