Compare commits

...

2 Commits

Author SHA1 Message Date
a5e413e216 fixed toc lag for card updates 2026-01-19 18:42:36 -05:00
dd84a2044f fixed issue with config 2026-01-19 18:35:34 -05:00

View File

@@ -519,6 +519,35 @@ function scheduleSidebarErrors() {
});
}
let tocUpdateFrame = null;
function scheduleTocUpdate() {
if (!toc) return;
if (tocUpdateFrame) return;
tocUpdateFrame = requestAnimationFrame(() => {
tocUpdateFrame = null;
updateToc(collectWorkspaces(), collectSites());
});
}
const TOC_NAME_INPUT_SELECTOR = [
".api-key-name",
".api-config-name",
".env-config-name",
".profile-name",
".task-name",
".shortcut-name",
".workspace-name",
".site-name",
".site-pattern"
].join(", ");
function handleTocNameInput(event) {
const target = event.target;
if (!(target instanceof Element)) return;
if (!target.matches(TOC_NAME_INPUT_SELECTOR)) return;
scheduleTocUpdate();
}
function renderGlobalSitesList(sites) {
if (!globalSitesContainer) return;
globalSitesContainer.innerHTML = "";
@@ -1230,6 +1259,7 @@ function updateApiConfigControls() {
if (moveDownBtn) moveDownBtn.disabled = index === cards.length - 1;
});
scheduleSidebarErrors();
scheduleTocUpdate();
}
function buildApiKeyCard(entry) {
@@ -1404,6 +1434,7 @@ function updateApiKeyControls() {
if (moveDownBtn) moveDownBtn.disabled = index === cards.length - 1;
});
scheduleSidebarErrors();
scheduleTocUpdate();
}
function updateApiConfigKeyOptions() {
@@ -1630,6 +1661,7 @@ function updateEnvControls(container = envConfigsContainer) {
if (moveDownBtn) moveDownBtn.disabled = index === cards.length - 1;
});
scheduleSidebarErrors();
scheduleTocUpdate();
}
function updateTaskEnvOptionsForContainer(container, envs, allEnvsById) {
@@ -1879,6 +1911,7 @@ function updateProfileControls(container = profilesContainer) {
if (moveDownBtn) moveDownBtn.disabled = index === cards.length - 1;
});
scheduleSidebarErrors();
scheduleTocUpdate();
}
function updateTaskProfileOptionsForContainer(container, profiles, allProfilesById) {
@@ -1952,7 +1985,9 @@ function updateEnvApiOptionsForContainer(container, apiConfigs) {
if (!container) return;
const selects = container.querySelectorAll(".env-config-api-select");
selects.forEach((select) => {
if (select.value) {
select.dataset.preferred = select.value;
}
populateSelect(select, apiConfigs, "No API configs configured");
});
}
@@ -2195,15 +2230,21 @@ function updateShortcutOptionsForContainer(container, options = {}) {
const profileSelect = card.querySelector(".shortcut-profile");
const taskSelect = card.querySelector(".shortcut-task");
if (envSelect) {
if (envSelect.value) {
envSelect.dataset.preferred = envSelect.value;
}
populateSelect(envSelect, envs, "No environments configured");
}
if (profileSelect) {
if (profileSelect.value) {
profileSelect.dataset.preferred = profileSelect.value;
}
populateSelect(profileSelect, profiles, "No profiles configured");
}
if (taskSelect) {
if (taskSelect.value) {
taskSelect.dataset.preferred = taskSelect.value;
}
populateSelect(taskSelect, tasks, "No tasks configured");
}
});
@@ -5026,6 +5067,7 @@ function updateShortcutControls(container = shortcutsContainer) {
if (moveDownBtn) moveDownBtn.disabled = index === cards.length - 1;
});
scheduleSidebarErrors();
scheduleTocUpdate();
}
function updateTaskControls(container = tasksContainer) {
@@ -5039,6 +5081,7 @@ function updateTaskControls(container = tasksContainer) {
if (moveDownBtn) moveDownBtn.disabled = index === cards.length - 1;
});
scheduleSidebarErrors();
scheduleTocUpdate();
}
function collectTasks(container = tasksContainer) {
@@ -6109,6 +6152,9 @@ async function initSettings() {
registerAllDetails();
restoreScrollPosition();
initDirtyObserver();
if (settingsLayout) {
settingsLayout.addEventListener("input", handleTocNameInput);
}
captureSavedSnapshot();
suppressDirtyTracking = false;
window.addEventListener("scroll", handleSettingsScroll, { passive: true });