我会复制我的issue,希望有人可以给我一个暗示我出错的地方。
这是GraphCool上的架构:
type Reservation implements Node {
createdAt: DateTime!
id: ID!@isUnique
updatedAt: DateTime!
user: User @relation(name: "UserReservations")
}
type User implements Node {
createdAt: DateTime!
id: ID!@isUnique
updatedAt: DateTime!
reservations: [Reservation!] !@relation(name: "UserReservations")
}
这是我的Angular代码中的一个片段:
fragment reservation on Reservation {
id,
user @include(
if :$is_admin) {
id
}
}
这是我的GraphQL查询:
mutation($id: ID!, $is_admin: Boolean = true) {
createReservation(userId: $id) {
...reservation
}
}
$ {
RESERVATION_FRAGMENT.reservation
}
使用apollo.watchQuery
调用上述变异在GraphCool上成功执行,但客户端产生以下错误:
Error: Invalid variable referenced in @include directive.
at directives.js: 42
at Array.some( < anonymous > )
at Object.shouldInclude(directives.js: 20)
at graphql.js: 27
at Array.forEach( < anonymous > )
at executeSelectionSet(graphql.js: 26)
at graphql.js: 55
at Array.forEach( < anonymous > )
at executeSelectionSet(graphql.js: 26)
at graphql.js: 94