Open pierretusseau opened 1 year ago
@pierretusseau Have you found solutions? I also want to know this.
I found a workaround for this problem. At first, define the schema before creating a store:
const schema = {
"options": {
"type": "object",
"properties": {
"items": {
"type": "object",
"properties": {
"preview": {
"type": "boolean",
"default": false
}
},
"required": ["preview"]
}
},
"required": ["items"]
}
};
const store = new Store({ schema });
Then you can use this to resets all keys within the options.items
to default values according to the json schema values.
store.set(`options.items`, {});
Unfortunately, the method store.reset(key)
also doesn't work for me properly.
Hello,
I've got defaults setup as such :
I'm looking to reset only
"options": {"items": { ... }}
in my store but I couldn't find how to do it.If I do a
store.reset('options')
all of my storeoptions
get correctly cleared, but also any other data inside of it (likeadmin
).I feel like
reset(...keys)
doesn't understand the dot notation, is there something I'm missing, or should I split my store into something like :