Skip to content

this in updateQuery  #154

@shtse8

Description

@shtse8

I want to access some properties of the component in updateQuery, but when I'm calliing this in updateQuery of Subscription, the this is referring to the object itself. How can I access the component this in the updateQuery?

subscribeToMore: {
  variables () {
    console.log('variables.this', this) // it's correct, vue component
    return {}
  },
  updateQuery (result, { subscriptionData }) {
    console.log('updateQuery.this', this) // it's wrong, just the object itself, I guess missing binding this
  }
}

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