Reactjs 扩展@connection节点并在本地存储中访问它
我正在尝试使用一个标志字段扩展@connection的节点,我会在单击时更新该字段: graphql中的连接: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
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
})