fix: can't add vars with same key name

This commit is contained in:
Arman committed 2022-11-02 11:09:58 +01:00
1 parent 694a8cff84
commit a4611b78b8
1 file changed
+10 -1
@@ -22,7 +22,16 @@
function handleCreated(dispatchEvent: CustomEvent) {
createFunction.update((n) => {
n.vars.push(dispatchEvent.detail);
if (n.vars.length) {
n.vars.map((v) => {
if (v.key !== dispatchEvent.detail.key) {
n.vars.push(dispatchEvent.detail);
}
});
} else {
n.vars.push(dispatchEvent.detail);
}
return n;
});
}