From 54a03a91b019af83c4717c49a6d8fb720e4b46f1 Mon Sep 17 00:00:00 2001 From: firestar5683 <168790843+firestar5683@users.noreply.github.com> Date: Sat, 5 Sep 2026 11:36:18 -0500 Subject: [PATCH] fix --- .../the_galaxy/assets/components/router.js | 2 +- .../components/tools/model_laboratory.js | 20 ++++++++++++++++--- .../system/the_galaxy/templates/index.html | 2 +- .../tests/test_frontend_module_graph.py | 9 +++++++-- 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/starpilot/system/the_galaxy/assets/components/router.js b/starpilot/system/the_galaxy/assets/components/router.js index d5019b9dd..e48f2797f 100644 --- a/starpilot/system/the_galaxy/assets/components/router.js +++ b/starpilot/system/the_galaxy/assets/components/router.js @@ -21,7 +21,7 @@ import { Sidebar } from "/assets/components/sidebar.js?v=controllers-nav-1" import { SentryMode } from "/assets/components/tools/sentry.js" import { SpeedLimits } from "/assets/components/tools/speed_limits.js" import { ModelManager } from "/assets/components/tools/model_manager.js?v=20260825a" -import { ModelLaboratory } from "/assets/components/tools/model_laboratory.js?v=model-lab-4" +import { ModelLaboratory } from "/assets/components/tools/model_laboratory.js?v=model-lab-5" import { LivePlots } from "/assets/components/tools/plots.js" import { ThemeMaker } from "/assets/components/tools/theme_maker.js" import { TestingGround } from "/assets/components/tools/testing_ground.js" diff --git a/starpilot/system/the_galaxy/assets/components/tools/model_laboratory.js b/starpilot/system/the_galaxy/assets/components/tools/model_laboratory.js index 592db14b6..f914307be 100644 --- a/starpilot/system/the_galaxy/assets/components/tools/model_laboratory.js +++ b/starpilot/system/the_galaxy/assets/components/tools/model_laboratory.js @@ -17,6 +17,7 @@ const state = reactive({ let initialized = false let pollHandle = null +let selectionDirty = false function modelById(modelId) { return state.models.find(model => model.value === modelId) @@ -55,12 +56,20 @@ function selectionError() { } function applyPayload(payload) { + const draftSelection = { + lateralModel: state.configuration.lateralModel, + longitudinalModel: state.configuration.longitudinalModel, + } state.chestnutReady = Boolean(payload?.chestnutReady) state.isOnroad = Boolean(payload?.isOnroad) state.configuration = { enabled: Boolean(payload?.configuration?.enabled), - lateralModel: String(payload?.configuration?.lateralModel || ""), - longitudinalModel: String(payload?.configuration?.longitudinalModel || ""), + lateralModel: selectionDirty + ? draftSelection.lateralModel + : String(payload?.configuration?.lateralModel || ""), + longitudinalModel: selectionDirty + ? draftSelection.longitudinalModel + : String(payload?.configuration?.longitudinalModel || ""), } state.runtime = payload?.runtime && typeof payload.runtime === "object" ? payload.runtime : {} state.download = payload?.download && typeof payload.download === "object" ? payload.download : {} @@ -127,6 +136,7 @@ async function save(enabled) { longitudinalModel: state.configuration.longitudinalModel, }), }) + selectionDirty = false applyPayload(payload) state.message = String(payload.message || "Model Laboratory configuration saved.") } catch (error) { @@ -173,6 +183,7 @@ function bindControls() { if (lateral.dataset.bound !== "1") { lateral.dataset.bound = "1" lateral.addEventListener("change", event => { + selectionDirty = true state.configuration.lateralModel = event.target.value const long = modelById(state.configuration.longitudinalModel) const lat = modelById(event.target.value) @@ -187,7 +198,10 @@ function bindControls() { longitudinal.value = state.configuration.longitudinalModel if (longitudinal.dataset.bound !== "1") { longitudinal.dataset.bound = "1" - longitudinal.addEventListener("change", event => { state.configuration.longitudinalModel = event.target.value }) + longitudinal.addEventListener("change", event => { + selectionDirty = true + state.configuration.longitudinalModel = event.target.value + }) } } if (enable && enable.dataset.bound !== "1") { diff --git a/starpilot/system/the_galaxy/templates/index.html b/starpilot/system/the_galaxy/templates/index.html index b80014cc8..0870ab1d2 100644 --- a/starpilot/system/the_galaxy/templates/index.html +++ b/starpilot/system/the_galaxy/templates/index.html @@ -51,7 +51,7 @@