Skip to content
Snippets Groups Projects
Commit fada4976 authored by HJ's avatar HJ :fire:
Browse files

extra protection to not write what we don't know

parent 914b4eb5
Branches
No related tags found
No related merge requests found
......@@ -111,7 +111,16 @@ const config = {
},
actions: {
loadSettings ({ dispatch }, data) {
Object.keys(this.state.config).forEach(
const knownKeys = new Set(Object.keys(this.state.config))
const presentKeys = new Set(Object.keys(data))
const intersection = new Set()
for (let elem of presentKeys) {
if (knownKeys.has(elem)) {
intersection.add(elem)
}
}
Object.keys(intersection).forEach(
name => dispatch('setOption', { name, value: data[name] })
)
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment