Skip to content

Can't seem to initialize data #274

@Christilut

Description

@Christilut
  data () {
    return {
      me: {
        name: null
      }
    }
  },

  apollo: {
    me: gql`{
        me {
          name
        }
      }`
  }

name remains null after the query. I can access the data but only with $data.$apolloData.data.me.name which seems like the wrong way.

If I remove the me {} property from data() then I get the following error:

TypeError: Cannot read property 'hasOwnProperty' of undefined
    at _loop (vue-apollo.esm.js?ebd5:3924)
    at VueComponent.launch (vue-apollo.esm.js?ebd5:3938)
    at callHook (vue.runtime.esm.js?ff9b:2917)
    at VueComponent.Vue._init (vue.runtime.esm.js?ff9b:4626)
    at new VueComponent (vue.runtime.esm.js?ff9b:4794)
    at createComponentInstanceForVnode (vue.runtime.esm.js?ff9b:4306)
    at init (vue.runtime.esm.js?ff9b:4127)
    at createComponent (vue.runtime.esm.js?ff9b:5604)
    at createElm (vue.runtime.esm.js?ff9b:5551)
    at VueComponent.patch [as __patch__] (vue.runtime.esm.js?ff9b:6087)

I just started this project with vue-cli 3 and added apollo with vue-cli.
I've disabled subscriptions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions