I have a question when it comes to caching in apollo/client for React Native. I understand the basics where you need an id _id for apollo to normalize the cache properly and not store the same data over and over again in the cache leading to increase memory usage after each query / mutation.
My question is though, is it needed for even a base query? Meaning if i have two queries
getChatRoomsForUser(): Rooms -> gets userId through context
Rooms: {
count: x amount of rooms
page: 1
rooms: [Room]
}
getRoom(roomId): Room
Room: {
id: 'string id',
name: 'room name',
description: 'room desc',
users: [User],
}
So we can see from this query, Rooms returns pagination and an array of Room objects. But NO id or _id.
Now because there is no _id or id in the original query, does that make it so apollo can not correctly normalize the data of Rooms, and every time that query is called it is then re added to the cache, rather than just updating what we have already queried for?
Would this also effect mutations and apollo not correctly updating cache since there is no id or _id on a typename of Rooms. So if i have a mutation to delete a specific room, then i wouldnt need an update/merge function if the return typename of Rooms had an id or _id so apollo could know which Rooms object the correct returned Room from the mutation would need to get updated? (doesnt have to be a remove mutation, any mutation that would change something on the Room object where it returned the same Room object)
And would this then compound for any other query / mutation that has no id or _id?