From e745b581aea1bcd5d4843a2312b6cd998d277273 Mon Sep 17 00:00:00 2001 From: Sam Wray Date: Wed, 9 Dec 2020 19:54:12 +0000 Subject: [PATCH] fix(input-config): adds clear action for focused input ids (#489) Adds a clear action to set the focused input id and title to null. Adds this to the activemodule.vue remove function to clear the input config panel when a focused module is removed closes #482 --- src/application/worker/store/modules/inputs.js | 4 ++++ src/components/ActiveModule.vue | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/application/worker/store/modules/inputs.js b/src/application/worker/store/modules/inputs.js index dd9b1a485..66b4e3317 100644 --- a/src/application/worker/store/modules/inputs.js +++ b/src/application/worker/store/modules/inputs.js @@ -21,6 +21,10 @@ const actions = { commit("SET_FOCUSED_INPUT", { id, title, writeToSwap }); }, + clearFocusedInput({ commit }) { + commit("SET_FOCUSED_INPUT", { id: null, title: null }); + }, + addInput({ commit }, { type, location, data, id = uuidv4(), writeToSwap }) { const input = { type, location, data, id }; commit("ADD_INPUT", { input, writeToSwap }); diff --git a/src/components/ActiveModule.vue b/src/components/ActiveModule.vue index ad8fb7b9b..9db338ab0 100644 --- a/src/components/ActiveModule.vue +++ b/src/components/ActiveModule.vue @@ -205,9 +205,11 @@ export default { return this.$modV.store.state.inputs.focusedInput.id === id; }, - removeModule(e) { + async removeModule(e) { if (e.keyCode === 8 || e.keyCode === 46) { this.$store.commit("ui-modules/SET_FOCUSED", null); + await this.$modV.store.dispatch("inputs/clearFocusedInput"); + this.$emit("remove-module", this.id); } }