Skip to content
Discussion options

You must be logged in to vote

Hi @gamberoillecito,

I believe what you are trying to do is migrate the state of the store.

There are several techniques you can use:

  • Use the callback beforeRead to detect if the data stored is an old version and migrate to new version.
  • Put a version field in the store and check that when instantiating the store.
  • Put a version number in the store's key, ie preferences.v1 and add some migration logic.
  • If it's just a simple addition of fields, allow the field to be missing, by checking if the field is undefined

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@gamberoillecito
Comment options

@joshnuss
Comment options

Answer selected by gamberoillecito
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants