Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variable "$filter_0" is not defined by operation “Route" #208

Closed
grydstedt opened this issue Sep 1, 2015 · 2 comments
Closed

Variable "$filter_0" is not defined by operation “Route" #208

grydstedt opened this issue Sep 1, 2015 · 2 comments

Comments

@grydstedt
Copy link

When using an input object with a connection I'm getting Variable "$filter_0" is not defined by operation “Route. Do I need to define all used variables in a Route somehow?

Example:

var PackagesRelay = Relay.createContainer(PackagesBase, {
  initialVariables: {
    first: PAGE_SIZE,
    filter: {sort: 'price_lh'}
  },
  fragments: {
    viewer: () => Relay.QL`
      fragment on Viewer {
        packages(first: $first, filter: $filter) {
          ${PackageListing.getFragment('packages')}
          pageInfo {
            hasNextPage
          }
        }
      }
    `
  }
});

This connection is defined as follows:

export default {
  type: Connection,
  description: 'Generic Package Queries',
  args: {
    ...connectionArgs,
    filter: {
      type: FilterInput
    }
  },
  resolve: (parent, args, info) => resolvePackageConnection(args, info)

};

Thanks for your help.

@grydstedt
Copy link
Author

Full query:

  "query": "query Route{viewer{id,..._0hccia}} fragment _2tm2pu7 on User{user_id,first_name,country,id} fragment _3ihrzs9 on Teacher{avg_rating,tutoring_rate,tutoring_bulk_rate,id} fragment _42dwm8y on Package{_id,title,description,image{url,id},language,max_difficulty,num_lessons,id} fragment _1f04xso on PackagesConnection{edges{node{_id,user{id,..._2tm2pu7},teacher{id,..._3ihrzs9},id,..._42dwm8y},cursor}} fragment _0hccia on Viewer{_packagesp6f3x5:packages(first:10,filter:$filter_0){totalCount,rangeBegin,rangeEnd,pageInfo{hasNextPage,hasPreviousPage},..._1f04xso},id}",
  "variables": {
    "filter_0": {
      "sort": "price_lh"
    }
  }
}

@grydstedt
Copy link
Author

Closing. Duplicate of #203

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant