Update frontend for presets, tabs, and help
Align frontend with new preset ID usage and shortened driver fields, improve tab/preset interactions, and refine help and editor UI.
This commit is contained in:
@@ -20,7 +20,20 @@ async function loadTabs() {
|
||||
const data = await response.json();
|
||||
|
||||
// Get current tab from cookie first, then from server response
|
||||
currentTabId = getCurrentTabFromCookie() || data.current_tab_id;
|
||||
const cookieTabId = getCurrentTabFromCookie();
|
||||
const serverCurrent = data.current_tab_id;
|
||||
const tabs = data.tabs || {};
|
||||
const tabIds = Object.keys(tabs);
|
||||
|
||||
let candidateId = cookieTabId || serverCurrent || null;
|
||||
// If the candidate doesn't exist anymore (e.g. after DB reset), fall back to first tab.
|
||||
if (candidateId && !tabIds.includes(String(candidateId))) {
|
||||
candidateId = tabIds.length > 0 ? tabIds[0] : null;
|
||||
// Clear stale cookie
|
||||
document.cookie = 'current_tab=; path=/; max-age=0';
|
||||
}
|
||||
|
||||
currentTabId = candidateId;
|
||||
renderTabsList(data.tabs, data.tab_order, currentTabId);
|
||||
|
||||
// Load current tab content if available
|
||||
|
||||
Reference in New Issue
Block a user