Reputation: 2733
I'm building a new createRefetchContainer()
off a working implementation in the same project, but getting this error on running yarn relay
:
ERROR:
GraphQLParser: Unknown field `usersByName` on type `Viewer`.
Source: document `AutocompleteUsersContainer_UsersRefetchQuery` file:
`client/components/Autocomplete/Users/AutocompleteUsersContainer.js`.
The erroring relay function:
export default createRefetchContainer(
AutocompleteUsers,
graphql`
fragment AutocompleteUsersContainer_viewer on Viewer
@argumentDefinitions(name: { type: "String", defaultValue: "" }) {
usersByName(name: $name)
}
`,
graphql`
query AutocompleteUsersContainer_UsersRefetchQuery(
$name: String!
) {
viewer {
usersByName(name: $name){
id
}
}
}
`
);
The working implementation:
export default createRefetchContainer(
AutocompleteLocations,
graphql`
fragment AutocompleteLocationsContainer_viewer on Viewer
@argumentDefinitions(searchValue: { type: "String", defaultValue: "" }) {
locations(searchValue: $searchValue)
}
`,
graphql`
query AutocompleteLocationsContainer_LocationsRefetchQuery(
$searchValue: String!
) {
viewer {
locations(searchValue: $searchValue)
}
}
`
);
The usersByName
query below returns results directly in graphql, which is why I'm not sure why relay
says Unknown field 'usersByname'
:
query getViewer{
viewer {
usersByName(
name: "Test Name"
) {
id
}
}
}
Upvotes: 0
Views: 745