vuejs / vuejs/apollo

Why does having categories as a field name errors out?

Open
#331 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
6k
Forks
516
PR merge metrics
No merged PRs in 30d

Description

I have the query below with categories as the field name

right now i renamed it to test and it works fine

but doing so with categories

would throw an error that it's undefined

why?

apollo: {
    plant: {
      query: gql`
        query Plant($id: ID) {
          plant(id: $id) @client {
            id
            commonName
            scientificName
            maxHeight
            nativeTo
            growingArea
            growingRate
            sunlightRequirement
            waterRequirement
            prices {
              id
              gallon
              size
              price
            }
            test: categories {
              id
              name
            }
          }
        }
      `,
      variables() {
        return {
          id: this.id
        }
      }
    }
  }

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Apollo query shown in the issue, comparing the direct categories field with the test: categories alias. Trace how the client handles the categories selection and capture the resulting error; done means identifying the cause and documenting or correcting the behavior, with a regression test if the repository provides a relevant test entry point.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, javascript
Domain
api, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.