Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to define custom storage keys for @observable properties? #95

Open
jaltin opened this issue Oct 4, 2021 · 1 comment

Comments

@jaltin
Copy link

jaltin commented Oct 4, 2021

Hi,

In the example of readme, one can persist in this way:

class SomeItem { @persist @observable name = 'some' }

This is nice and straightforward, but causes problems if I want to refactor a property name (e.g. if I want to rename observable from 'name' to 'firstName'.

If I do that renaming, the value persisted in 'name' will be lost.

Ideally to get around this, I would like to have the possibility to optionally define a storage key, something similar to this:

class SomeItem { @persist('MY_CUSTOM_KEY_THAT_DOES_NOT_CHANGE') @observable name = 'some' }

Is this possible to achieve?

@agestaun
Copy link

Same situation, I want to rename the variable name and I am losing all the data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants