fix: collect all support services before rendering sidebar (code review fix)

Agent-Logs-Url: https://github.com/naturallaw777/staging_alpha/sessions/4304350a-bc4f-4698-82b5-8ee28f0ad960

Co-authored-by: naturallaw777 <99053422+naturallaw777@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-04-03 18:02:06 +00:00
committed by GitHub
parent c6868b63bc
commit 02ae34dbd0

View File

@@ -172,17 +172,19 @@ async function apiFetch(path, options) {
function buildTiles(services, categoryLabels) { function buildTiles(services, categoryLabels) {
_servicesCache = services; _servicesCache = services;
var grouped = {}; var grouped = {};
var supportServices = [];
for (var i = 0; i < services.length; i++) { for (var i = 0; i < services.length; i++) {
var svc = services[i]; var svc = services[i];
// Support tiles go to the sidebar, not the main grid // Support tiles go to the sidebar, not the main grid
if (svc.category === "support" || svc.type === "support") { if (svc.category === "support" || svc.type === "support") {
renderSidebarSupport(svc); supportServices.push(svc);
continue; continue;
} }
var cat = svc.category || "other"; var cat = svc.category || "other";
if (!grouped[cat]) grouped[cat] = []; if (!grouped[cat]) grouped[cat] = [];
grouped[cat].push(svc); grouped[cat].push(svc);
} }
renderSidebarSupport(supportServices);
$tilesArea.innerHTML = ""; $tilesArea.innerHTML = "";
var orderedKeys = CATEGORY_ORDER.filter(function(k) { return grouped[k]; }); var orderedKeys = CATEGORY_ORDER.filter(function(k) { return grouped[k]; });
Object.keys(grouped).forEach(function(k) { Object.keys(grouped).forEach(function(k) {
@@ -208,8 +210,10 @@ function buildTiles(services, categoryLabels) {
} }
} }
function renderSidebarSupport(svc) { function renderSidebarSupport(supportServices) {
$sidebarSupport.innerHTML = ""; $sidebarSupport.innerHTML = "";
for (var i = 0; i < supportServices.length; i++) {
var svc = supportServices[i];
var btn = document.createElement("button"); var btn = document.createElement("button");
btn.className = "sidebar-support-btn"; btn.className = "sidebar-support-btn";
btn.innerHTML = btn.innerHTML =
@@ -220,10 +224,13 @@ function renderSidebarSupport(svc) {
'</span>'; '</span>';
btn.addEventListener("click", function() { openSupportModal(); }); btn.addEventListener("click", function() { openSupportModal(); });
$sidebarSupport.appendChild(btn); $sidebarSupport.appendChild(btn);
}
if (supportServices.length > 0) {
var hr = document.createElement("hr"); var hr = document.createElement("hr");
hr.className = "sidebar-divider"; hr.className = "sidebar-divider";
$sidebarSupport.appendChild(hr); $sidebarSupport.appendChild(hr);
} }
}
function buildTile(svc) { function buildTile(svc) {
var isSupport = svc.type === "support"; var isSupport = svc.type === "support";