From f0d8de490cd12340dee49858de465515410c1c13 Mon Sep 17 00:00:00 2001 From: dirwin31 <83434411+dirwin31@users.noreply.github.com> Date: Thu, 27 Aug 2026 17:56:50 -0700 Subject: [PATCH] so tired of changing these files --- .../components/recordings/dashcam_routes.js | 6 +++--- .../recordings/dashcam_routes_helpers.js | 5 +++++ .../tests/test_dashcam_routes_helpers.py | 15 ++++++++++++++- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/starpilot/system/the_galaxy/assets/components/recordings/dashcam_routes.js b/starpilot/system/the_galaxy/assets/components/recordings/dashcam_routes.js index 142dd616a..7ac402262 100644 --- a/starpilot/system/the_galaxy/assets/components/recordings/dashcam_routes.js +++ b/starpilot/system/the_galaxy/assets/components/recordings/dashcam_routes.js @@ -12,6 +12,7 @@ import { groupRoutesForView, MAX_RENDERED_ROUTES, normalizeRoute, + routeViewRenderKey, } from "/assets/components/recordings/dashcam_routes_helpers.js" const state = reactive({ @@ -114,8 +115,6 @@ function changeSortOrder(event) { const sortOrder = String(event.target.value || "") if (!["newest", "oldest", "longest", "shortest"].includes(sortOrder)) return state.sortOrder = sortOrder - // Replacing the array forces the keyed route templates to move immediately. - state.routes = [...state.routes] } if (!isGalaxyTunnel()) refresh() @@ -853,6 +852,7 @@ export function RouteRecordings() { ${() => { const view = buildRouteView(state.routes, { preservedOnly: state.showPreservedOnly, searchQuery: state.searchQuery, sortOrder: state.sortOrder }) const groups = groupRoutesForView(view.visible, state.sortOrder) + const renderKey = routeViewRenderKey(view.visible, state.sortOrder, state.viewMode) return html`
@@ -863,7 +863,7 @@ export function RouteRecordings() { ${state.isDeletingAll ? html`

Deleting routes…

` : ""} ${!view.visible.length && state.loading ? html`

Finding local routes…

` : ""} ${!view.visible.length && !state.loading && !state.isDeletingAll ? html`

${state.routes.length ? "No routes match these filters." : "No routes found."}

` : ""} -
+
${groups.map(group => html`
diff --git a/starpilot/system/the_galaxy/assets/components/recordings/dashcam_routes_helpers.js b/starpilot/system/the_galaxy/assets/components/recordings/dashcam_routes_helpers.js index e4aa5b1ad..fc8600882 100644 --- a/starpilot/system/the_galaxy/assets/components/recordings/dashcam_routes_helpers.js +++ b/starpilot/system/the_galaxy/assets/components/recordings/dashcam_routes_helpers.js @@ -177,6 +177,11 @@ export function buildRouteView(routes, options = {}) { } } +export function routeViewRenderKey(routes, sortOrder = "newest", viewMode = "list") { + const routeNames = Array.isArray(routes) ? routes.map(route => String(route?.name || "")).join(",") : "" + return `${viewMode}:${sortOrder}:${routeNames}` +} + function localDayKey(date) { return `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}` } diff --git a/starpilot/system/the_galaxy/tests/test_dashcam_routes_helpers.py b/starpilot/system/the_galaxy/tests/test_dashcam_routes_helpers.py index 897aac37a..1e1a5c4c9 100644 --- a/starpilot/system/the_galaxy/tests/test_dashcam_routes_helpers.py +++ b/starpilot/system/the_galaxy/tests/test_dashcam_routes_helpers.py @@ -83,7 +83,7 @@ def test_sort_order_select_and_route_items_are_keyed_and_reactive(): source = COMPONENT_PATH.read_text(encoding="utf-8") assert '