0
我正在嘗試在我的模式中創建一個分頁繼電器& graphql。這是我的代碼:如何在relay和graphql模式中正確創建連接?
const GraphQLFriendByUser = new GraphQLObjectType({
name: 'FriendByUser',
fields: {
id: globalIdField('FriendByUser'),
_id: {
type: GraphQLString,
resolve: (root) => root._id,
},
email: {
type: GraphQLBoolean,
resolve: (root) => root.email,
},
fullName: {
type: GraphQLString,
resolve: (root) => {
return root.fullName;
},
},
},
interfaces: [nodeInterface],
});
const {
connectionType: FriendsByUserConnection,
edgeType: GraphQLFriendByUserEdge,
} = connectionDefinitions({
name: 'FriendByUser',
nodeType: GraphQLFriendByUser,
});
我創造了這個在待辦事項現代同樣在看樣品,在我TodoListHome組件,這是我graphql查詢:
friendsByUserContext(first: 200) @connection(key: "TodoListHome_friendsByUserContext") {
id
_id
fullName
email
}
有當我更新的模式沒有問題,但是當我嘗試建立,這是我的錯誤:
Invariant Violation: RelayParser: Unknown field
id
on typeFriendByUserConnection
. Source: documentTodoListHome_viewer
file:C:\Users\PE60\Desktop\socialnetworking-todoapp\js\components\TodoListHome.js
.
執行甚至沒有達成解決,所以我無法登錄。但我相信錯誤不在那裏。幫幫我?