Hey guys, I’m trying to to understand Apollo Client cache better and could really use your help.
As far as I know, after using useQuery and populating the cache, it gets saved in two ways:
-Inside of the normalized flattened table, in which all the entities are saved with refs from one to another
-As a query, inside the ROOT_QUERY object
With this knowledge, I want to make sure of some things:
- When running a query I haven’t run yet, will Apollo try to form this query using data from the normalized table, and only if he can’t manage that, fetch the query from the server?
Or will it go straight to the server?
- After one happens, will Apollo insert the query to ROOT_QUERY and also update the normalized table?
Are they always updated together?
- Are there any more advantages to saving the previously run queries, other then for the order of the data inside of them as it was when the query was first run?
- Supposing I returned all the proper fields while running a mutation, will both of the cache sources update? (normalized table and ROOT_QUERY)
- Are the active queries deleted when the component that requested them is unmounted?
Thanks in advance,
Ido (new apolloClient enthusiastic )