-
-
Notifications
You must be signed in to change notification settings - Fork 522
Closed
Description
EDIT: After some investigation I find I only get this error when navigating away from the page and to a page with asyncData.
I'm having trouble using smart queries in my Nuxt app.
export default {
data () {
return {
journalEntries: []
}
},
apollo: {
journalEntries: {
query: JOURNAL_ENTRIES_QUERY
}
}
}
The query works fine at first load (and if I use asyncData), but if I navigate away from the page the component is on and come back, I get this error:
vue-apollo.esm.js:2977 Uncaught TypeError: Cannot read property 'loading' of undefined
at SmartQuery.get$$1 (vue-apollo.esm.js:2977)
at SmartQuery.loadingDone (vue-apollo.esm.js:2881)
at SmartQuery.nextResult (vue-apollo.esm.js:2828)
at notifySubscription (Observable.js:126)
at flushSubscription (Observable.js:112)
at Observable.js:156
at Observable.js:67
My Apollo client configuration:
import { ApolloLink, concat } from 'apollo-link'
import { HttpLink } from 'apollo-link-http'
import { InMemoryCache } from 'apollo-cache-inmemory'
export default (ctx) => {
const httpLink = new HttpLink({ uri: 'http://localhost:4000/' })
const middlewareLink = new ApolloLink((operation, forward) => {
const { token } = ctx.store.state.auth
operation.setContext({
headers: { authorization: token ? `Bearer ${token}` : '' }
})
return forward(operation)
})
const link = concat(middlewareLink, httpLink)
return {
link,
cache: new InMemoryCache()
}
}
I'm using Nuxt v1.0.0 and nuxt-apollo plugin 3.0.6
Metadata
Metadata
Assignees
Labels
No labels