cache.readQuery - local field and new schema version

Hi,
I have a few local field (@client) on app, apollo cache is persistent in local storage. After I update a client and add new local field, new client can’t read old cache field because in local storage new field not exist and as is described in docs Reading and writing data to the cache - Apollo GraphQL Docs readQuery return null.

Do you know how I should handle this? Why don’t return null only for one new field? Or should I stored also schema version and compare it, if not exist delete cache/localstorage? What is correct way to add @client fields to schema, when cache is persisted on client?

Use case, I had old client with local schema, apollo cache is persistant. Update client on new version with different local schema, and load cache from persistant storage, make query but return null because new field not exist in old schema, I can’t read any data, also don’t know when I should delete local cache. One hack is store separate version client and compare it on aplication start, if not patch delete persistent storage, but dont like the idea. Do you have something better? Thanks!

If you’re adding a new field, I think you can use the read function in the field’s type policy to provide a default value: Customizing the behavior of cached fields - Apollo GraphQL Docs
But if you make any changes to existing fields, you’ll probably need to delete the cache (your versioning idea seems like it would work well for that).