Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 扩展@connection节点并在本地存储中访问它_Reactjs_Graphql_Relayjs_Relay - Fatal编程技术网

Reactjs 扩展@connection节点并在本地存储中访问它

Reactjs 扩展@connection节点并在本地存储中访问它,reactjs,graphql,relayjs,relay,Reactjs,Graphql,Relayjs,Relay,我正在尝试使用一个标志字段扩展@connection的节点,我会在单击时更新该字段: graphql中的连接: type Me implements Node { id: ID! giftRecipientsConnection( query: String! after: String first: Int before: String last: Int ): GiftRecipientConnection } "An edg

我正在尝试使用一个标志字段扩展@connection的节点,我会在单击时更新该字段:

graphql中的连接:

type Me implements Node {
  id: ID!
  giftRecipientsConnection(
    query: String!

    after: String
    first: Int
    before: String
    last: Int
  ): GiftRecipientConnection
}

"An edge in a connection."
type GiftRecipientEdge {
  "The item at the end of the edge"
  node: GiftRecipient

  "A cursor for use in pagination"
  cursor: String!
}

"A GiftRecipient"
type GiftRecipient {
  platform: Platform!
  platformIcon: Image!
  followers: Int!
  userName: String!
  avatar: Image!
  avatarBackground: Image!
  isGiftable: Boolean!
  hashId: String!
}
客户端架构:

extend type GiftRecipient {
  isSelected: Boolean
}

这是我的组件(查询可能并不理想,因为我仍在使用它,但它可以工作):

在我的组件中,我希望按照以下方式进行更新:

commitLocalUpdate(relay.environment, store => {
    const me = store.getRoot().getLinkedRecord("me")
    const giftRecipientConnectionRecord = me.getLinkedRecord("giftRecipientsConnection") // returns undefined right now    
    ... rest of the code
})
   

现在我如何处理本地州的连接

commitLocalUpdate(relay.environment, store => {
    const me = store.getRoot().getLinkedRecord("me")
    const giftRecipientConnectionRecord = me.getLinkedRecord("giftRecipientsConnection") // returns undefined right now    
    ... rest of the code
})