简体   繁体   English

中继 ConnectionHandler.getConnectionID() 连接不存在错误

[英]Relay ConnectionHandler.getConnectionID() connection does not exist error

I'm trying to cleanup relay graphql flow in my app.我正在尝试在我的应用程序中清理中继 graphql 流。 Atm in some places I'm still using fetchKey and record invalidation, which I'd like to change to @appendEdge/@appendNode directives. Atm 在某些地方我仍在使用 fetchKey 和记录失效,我想将其更改为 @appendEdge/@appendNode 指令。 Unfortunately every time I'm trying to get the proper connection on which I'm going to use them, it ends up with warnings stating:不幸的是,每次我试图获得要使用它们的正确连接时,最终都会出现警告说明:

Warning: [Relay][Mutation] The connection with id 'client:ParentType14nif3uirdfut431431hg2rr:__ParentTypeChildrenList_children_connection' doesn't exist.

I'm using ConnectionHandler.getConnectionID(<id of the parent object of the fragment>, <connection key I've specified>) .我正在使用ConnectionHandler.getConnectionID(<id of the parent object of the fragment>, <connection key I've specified>)

Does anyone know what may be the issue here?有谁知道这里可能是什么问题? Also if I understand correctly and if that works my edge is supposed to be added to the store and relay will only determine whether everything is up-to-date without fetching that new edge from the server, right?此外,如果我理解正确并且如果这有效,我的边缘应该被添加到商店和中继将只确定一切是否是最新的,而不从服务器获取新的边缘,对吧?

Relay matches connection identity not only by the parent id and connection key but also using the latest arguments ("filters) that connection was called with. By passing filters: [] to the connection you're telling relay that no arguments should be used to determine connection identity. This can work sometimes but if your arguments actually affect the output of your connection this can introduced some unexpected behaviors, such as your connection results not updating when only some argument has changed. Alternatively you can pass the latest arguments you called your connection with to your getConnectionId call. This can be very verbose and difficult to do at times but there's no other work around.中继不仅通过父 ID 和连接密钥匹配连接标识,而且还使用最新的 arguments(“过滤器”)调用连接。通过将filters: []传递给连接,您告诉中继不应该使用 arguments确定连接身份。这有时可以工作,但如果您的 arguments 实际上影响您的连接的 output 这可能会引入一些意外行为,例如当只有某些参数发生更改时您的连接结果不会更新。或者您可以传递最新的 ZDBC11CAA5BDA99F77E6FB4DABD88连接到您的getConnectionId调用。这可能非常冗长,有时很难做到,但没有其他解决方法。

From the docs: https://relay.dev/docs/guided-tour/list-data/updating-connections/#connection-identity-with-filters来自文档: https://relay.dev/docs/guided-tour/list-data/updating-connections/#connection-identity-with-filters

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM