vuex-orm / plugin-graphql

Vuex ORM persistence plugin to sync the store against a GraphQL API.
https://vuex-orm.github.io/plugin-graphql/
MIT License
227 stars 52 forks source link

ID being stripped from Query #140

Open zyonnetworks opened 4 years ago

zyonnetworks commented 4 years ago

My model has ID, but it's being stripped from the query after being built. How do I force ID to be a part of the query without creating a custom query?

export default class User extends Model {
  static entity = 'users'
  static primaryKey = ['id']

  static fields() {
    return {
      id: this.attr(null),
      firstName: this.string(''),
  }
}

produces this graphQL query... query Users { query users { firstName } }

I expect it to product this query... query Users { query users { id firstName } }

When running User.fetch(); it causes ID to be set to _no_key_48466. My schema contains ID. Here is my graphQL schema.

type User {
  id: ID! @id
  firstName: String
}

Thanks in advance.

phortx commented 4 years ago

Hi, could you please check if this still is a problem in the latest release?