【发布时间】:2019-10-23 14:44:42
【问题描述】:
我在中继 paginationContainer 组件中订阅了一条新记录。当它从后端检索新记录时,我以这种方式将其插入连接(在requestSubscription 的updater 选项内):
const newEdge = ConnectionHandler.createEdge(
store,
connection,
newPostNode,
'posts'
)
ConnectionHandler.insertEdgeBefore(connection, newEdge)
当我在console.log(props.posts.edges) 中看到一个新的插入边缘时,它可以正常工作。
然而,这个新插入边的cursor 参数是undefined,而它的node 参数本身就是一条记录,正如我所料。
我认为这是不正确的,因为连接中的每条边都必须有一个cursor。
将新边缘插入中继连接以使其包含cursor 的正确方法是什么?
【问题讨论】:
标签: connection graphql graphql-js relayjs relay