I'm using URQL to query (UserItemsQuery) a list of items, and to create new items (CreateItem). These items belong to a user.
In normal circumstances, I would use updateQuery to add the newly created item that is returned from createItem to the cache:
Mutation: {
createItem(result, { params: { userId } }, cache) {
cache.updateQuery(
{
query: UserItemsQuery,
variables: { id: userId },
},
(data) => {
if (!data) return null
data.user.items.nodes.push(result.createItem.item)
return data
}
)
},
However, the query to userItemsQuery is paginated:
resolvers: {
User: {
chatMessages: relayPagination(),
},
},
So in order to use updateQuery, I need to know the pagination details for the last query to UserItemsQuery so I can re-query with the correct pagination. How can I access those params?