nuwave / nuwave/lighthouse

Using query variable as a parameter in a nested field

Open
#1,812 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs reproduction
Dominant language
PHP
Stars
3.5k
Forks
468
Avg merge
3h 9m
Merged PRs (30d)
2

Description

I'm trying to use a variable passed as a parameter for a nested field.
I can't figure out if its lighthouse not properly parsing this or if I'm using the wrong format.
Is this supposed to work? I inspected the parsed query from the server and it seems I'm getting no value for my varaible $page

import { gql } from "@apollo/client";

export const MY_QUERY = gql`
  query MY_QUERY($group: String!, $page: Int!) {
    myGroups(input: {group: $group, page: $page}) {
      
      groups {
        styleA(page: $page) {
          name
        }
      }

    }
  }
`;


const {loading: Loading, data : Data, error: Error } = useQuery(MY_QUERY, {
  variables: {
    group: group,
    page: page
  }
});

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 with the supplied MY_QUERY and the useQuery variables, then trace how Lighthouse parses variables used in the nested styleA field. No repository file, test, or entry point is named; done means reproducing the query behavior and establishing whether nested-field variables are supported or need a documented fix.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, javascript, laravel, php
Domain
api, backend
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.