plugin-graphql icon indicating copy to clipboard operation
plugin-graphql copied to clipboard

ID being stripped from Query

Open zyonnetworks opened this issue 4 years ago • 1 comments

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.

zyonnetworks avatar Jan 02 '20 08:01 zyonnetworks

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

phortx avatar May 02 '20 20:05 phortx