I'm having a really hard time trying to understand how to restore data properly.
I managed to restore simple data (when key is a string) by overwriting the initial state. So before client.writeData(myInitialState) I replace values with those from the localStorage.
However, it doesn't work for arrays which are somehow modified when saving to the apollo cache.
For example, an initial state like this:
is transformed (normalized?) to this:
{
agents: {type: "json", json: []}
}
When I set an initial state with the above, transformed version, my mutation doesn't work.
I'm having a really hard time trying to understand how to restore data properly.
I managed to restore simple data (when key is a string) by overwriting the initial state. So before
client.writeData(myInitialState)I replace values with those from the localStorage.However, it doesn't work for arrays which are somehow modified when saving to the apollo cache.
For example, an initial state like this:
is transformed (normalized?) to this:
When I set an initial state with the above, transformed version, my mutation doesn't work.