I'm trying to cleanup relay graphql flow in my app. Atm in some places I'm still using fetchKey and record invalidation, which I'd like to change to @appendEdge/@appendNode directives. 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>).
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 yourgetConnectionIdcall. This can be very verbose and difficult to do at times but there's no other work around.From the docs: https://relay.dev/docs/guided-tour/list-data/updating-connections/#connection-identity-with-filters