From aea796393cdaf983517f9febbf5faa9e82c778a7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 30 Sep 2026 16:42:36 +0000 Subject: [PATCH] fix(review): apply Codex review fixes (turn 2) - openc3-cosmos-init/plugins/packages/openc3-vue-common/src/components/Openc3Screen.vue:255 - JSON comparison threw on telemetry arrays containing BigInts; replaced it with recursive equality. - openc3-cosmos-init/plugins/packages/openc3-vue-common/src/widgets/VWidget.js:84 - The fade watcher could compare the previous rendered value and stop fading prematurely; it now reads the current computed value. AI-Review-Bot: true AI-Review-Run: 36745680936 --- .../src/components/Openc3Screen.vue | 18 ++++++++++++++---- .../openc3-vue-common/src/widgets/VWidget.js | 7 +++++-- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/openc3-cosmos-init/plugins/packages/openc3-vue-common/src/components/Openc3Screen.vue b/openc3-cosmos-init/plugins/packages/openc3-vue-common/src/components/Openc3Screen.vue index b87bb5e776..3a390a2607 100644 --- a/openc3-cosmos-init/plugins/packages/openc3-vue-common/src/components/Openc3Screen.vue +++ b/openc3-cosmos-init/plugins/packages/openc3-vue-common/src/components/Openc3Screen.vue @@ -249,17 +249,27 @@ const MAX_ERRORS = 20 // Identifies our own get_tlm_values poll as the source of a transient error const POLL_ERROR_SOURCE = 'screen:get_tlm_values' -// Values compare equal if they're the same primitive or serialize the same. +// Values compare equal if they're the same primitive or have equal contents. // Array and object values (ARRAY widgets, BLOCK, etc) come back as new objects -// every poll so they need the JSON comparison. +// every poll. Compare recursively because telemetry can contain BigInts. function sameValue(a, b) { if (Object.is(a, b)) { return true } - if (a === null || b === null || typeof a !== 'object') { + if ( + a === null || + b === null || + typeof a !== 'object' || + typeof b !== 'object' || + Array.isArray(a) !== Array.isArray(b) + ) { return false } - return JSON.stringify(a) === JSON.stringify(b) + const keys = Object.keys(a) + return ( + keys.length === Object.keys(b).length && + keys.every((key) => Object.hasOwn(b, key) && sameValue(a[key], b[key])) + ) } export default { diff --git a/openc3-cosmos-init/plugins/packages/openc3-vue-common/src/widgets/VWidget.js b/openc3-cosmos-init/plugins/packages/openc3-vue-common/src/widgets/VWidget.js index 7400cd26a3..609425206f 100644 --- a/openc3-cosmos-init/plugins/packages/openc3-vue-common/src/widgets/VWidget.js +++ b/openc3-cosmos-init/plugins/packages/openc3-vue-common/src/widgets/VWidget.js @@ -82,7 +82,10 @@ export default { }, watch: { _counter: function (newVal, oldVal) { - if (this.curValue !== this.prevValue) { + // Refresh the computed value before comparing: this watcher runs before + // rendering, and the screen stops updates once the fade is complete. + const value = this._value + if (value !== this.prevValue) { this.grayLevel = AGING_START } else { this.grayLevel -= this.grayRate @@ -90,7 +93,7 @@ export default { this.grayLevel = AGING_MIN } } - this.prevValue = this.curValue + this.prevValue = value }, }, computed: {