convoyinc / apollo-cache-hermes

A cache implementation for Apollo Client, tuned for performance

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Migration to support use of information elsewhere in the persisted cache data

bienur opened this issue · comments

Currently, Hermes migrates persisted data on a per-entity basis as part of the restore(). Which makes it difficult to migrate based on information stored elsewhere in the persisted cache snapshot.

Consider the following case where the new version of code introduces a new field on User, experimentTreatments2 (an object), to replace/deprecate the old experimentTreatments (an entity array). Rather than dumbly initializes experimentTreatments2 to {}, we want the migration to initialize it with information from experimentTreatments. One can imagine similar situations with need like this. However, it's not something that can be done easily today.

Might be worth considering adding the support.