From 4b7d72c06b50edc3b2d33a99689295980e82d6d1 Mon Sep 17 00:00:00 2001 From: Ryan Pratt Date: Thu, 2 Jan 2025 13:25:18 -0700 Subject: [PATCH] Fix initial items in TargetPacketItemChooser This fixes the bug where PacketViewer appeared to not remember the last selected packet in the default config --- .../src/components/TargetPacketItemChooser.vue | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/openc3-cosmos-init/plugins/packages/openc3-vue-common/src/components/TargetPacketItemChooser.vue b/openc3-cosmos-init/plugins/packages/openc3-vue-common/src/components/TargetPacketItemChooser.vue index 48b71fd6a3..6c6acc47a9 100644 --- a/openc3-cosmos-init/plugins/packages/openc3-vue-common/src/components/TargetPacketItemChooser.vue +++ b/openc3-cosmos-init/plugins/packages/openc3-vue-common/src/components/TargetPacketItemChooser.vue @@ -323,6 +323,24 @@ export default { }, }, watch: { + initialTargetName: function (val) { + // These three "initial" watchers are here in case the parent component doesn't figure out its inital values + // until after this component has already been created. All this logic incl. the "on-set" events could be + // simplified with a refactor to use named v-models, but that's probably a significant breaking change. + if (val) { + this.selectedTargetName = val.toUpperCase() + } + }, + initialPacketName: function (val) { + if (val) { + this.selectedPacketName = val.toUpperCase() + } + }, + initialItemName: function (val) { + if (val) { + this.selectedItemName = val.toUpperCase() + } + }, mode: function (newVal, oldVal) { this.selectedPacketName = null this.selectedItemName = null