Do you want to request a feature or report a bug?
bug/feature request
What is the current behavior?
After rehydrating some accessors have an incorrect name if using _ to denote a private field.
I'm going down the route of using classes whose intended private members are prefixed with _. In order to access said private fields I am using accessors whose name DO NOT include this underscore prefix. Based on the current functionality this means that when the store state is rehydrated my accessors have the wrong name.
Example:
export default class Vehicle {
_position;
constructor(...) { ... }
get position() {
return this._position;
}
}
After rehydrating the accessor is no longer position() but is instead _position().
If the current behavior is a bug, please provide the steps to reproduce.
Create a Vue project with Vuex and Vuex-persistedstate using the default createPersistedState()
Create the class above, or another with prefixed members and accessors which lack the
Save such an object into the store and persist it to local storage
Rehydrate the store state from local storage
Notice the position() accessor has been replaced with _position().
What is the expected behavior?
The data will be deserialised to the class provided in the first place. i.e., Vehicle in = Vehicle out.
If this is a feature request, what is motivation or use case for changing the behavior?
So members intended to be private can be distinguished from public ones and still work before and after the store state is persisted.
Yeah you have to serialize and deserialize class instance yourself. The plugin is not going to do that. Please move the question to the Vue Forum or StackOverflow.
Do you want to request a feature or report a bug? bug/feature request
What is the current behavior? After rehydrating some accessors have an incorrect name if using _ to denote a private field.
I'm going down the route of using classes whose intended private members are prefixed with _. In order to access said private fields I am using accessors whose name DO NOT include this underscore prefix. Based on the current functionality this means that when the store state is rehydrated my accessors have the wrong name.
Example:
After rehydrating the accessor is no longer
position()
but is instead_position()
.If the current behavior is a bug, please provide the steps to reproduce.
createPersistedState()
position()
accessor has been replaced with_position()
.What is the expected behavior? The data will be deserialised to the class provided in the first place. i.e.,
Vehicle
in =Vehicle
out.If this is a feature request, what is motivation or use case for changing the behavior? So members intended to be private can be distinguished from public ones and still work before and after the store state is persisted.