に未定義のまま -変数ID!私が変異を持っているgraphql突然変異
`export const setTimeLineOnUser = gql
mutation ($tID: ID!, $uID: ID!){
setTimeLineOnUser(userTimeLineId: $tID, timeLineUserId: $uID){
userTimeLine {
id
updatedAt
posts{
id
postType
updatedAt
}
}
timeLineUser {
id
name
email
}
}
};`
とこのようになります機能 -
`this.props.createTimeLine().then((response) => {
console.log(response.data.createTimeLine.id);
this.addTimeLineToUser(response.data.createTimeLine.id, this.props.userQuery.user.id);
});`
ユーザーは、このようなものの関係-to 1を持っている -
`setTimeLineOnUser(userTimeLineId: ID!, timeLineUserId: ID!): SetTimeLineOnUserPayload`
実行中にこのエラーが表示される -
Error: GraphQL error: Variable '$tID' expected value of type 'ID!' but value is undefined. Reason: Expected non-null value, found null. (line 1, column 11): mutation ($tID: ID!, $uID: ID!) { ^ GraphQL error: Variable '$uID' expected value of type 'ID!' but value is undefined. Reason: Expected non-null value, found null. (line 1, column 22): mutation ($tID: ID!, $uID: ID!) { ^ at new ApolloError (apollo.umd.js:1959) at apollo.umd.js:2670 at tryCallOne (core.js:37) at core.js:123 at JSTimers.js:117 at Object.callTimer (JSTimersExecution.js:95) at Object.callImmediatesPass (JSTimersExecution.js:199) at Object.callImmediates (JSTimersExecution.js:214) at MessageQueue.js:228 at MessageQueue.__guard (MessageQueue.js:218)
console.log(this.props.userQuery.user.id);
が有効なIDを返していますが、 私は、それらがヌルではないかもしれないが、まだ使用されていないように、状態にIDを割り当てる突然変異を作ろうと試みました!私が間違っていることは何ですか?
ファイルを見たい場合は、ここに行く - あなたはaddTimelineToUser
オブジェクトを与えていますが、両方のパラメータが必要呼び出すときGist
console.log(this.props.userQuery.user.id); componentDidMountで実際にnullを返しません/未定義uidを返します。機能が起動される前でさえ、 –
これは実際に働いた!異なる組み合わせで3日間試してみましたが、これは実際に働いていました。ありがとう –
素晴らしい!助けになる喜び –