fix: не терять новые категории (SYS) на вкладке «Прочее»
ASSIGNED_CATEGORIES пересчитывался из всех вкладок TAB_CONFIG уже после того, как неизвестные категории попадали в TAB_CONFIG.other — из-за этого они сами себя исключали из фильтра "not assigned" на вкладке «Прочее». Баг был в двух местах (loadCategoriesFromAPI и applyServerSettings), второе не проявлялось только потому, что синк qt_settings с сервера никогда не был подключён к воркеру. Заодно подключил Service.SyncQtSettings к фоновому синку (был мёртвым кодом), чтобы tab_config/config_types и т.п. реально доезжали с сервера до локального кеша. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
e5aa1dfd38
commit
dd70b6065b
@@ -832,13 +832,13 @@ async function loadCategoriesFromAPI() {
|
||||
.sort((a, b) => a.display_order - b.display_order)
|
||||
.map(cat => cat.code);
|
||||
|
||||
// Rebuild ASSIGNED_CATEGORIES from known (non-"other") tabs before
|
||||
// populating "other", so unassigned categories aren't immediately
|
||||
// excluded from the "other" tab by their own assignment.
|
||||
ASSIGNED_CATEGORIES = knownCodes;
|
||||
|
||||
// Update "other" tab with unassigned categories
|
||||
TAB_CONFIG.other.categories = unassignedCategories;
|
||||
|
||||
// Rebuild ASSIGNED_CATEGORIES
|
||||
ASSIGNED_CATEGORIES = Object.values(TAB_CONFIG)
|
||||
.flatMap(t => t.categories)
|
||||
.map(c => ciStr(c));
|
||||
} catch(e) {
|
||||
console.error('Failed to load categories, using defaults', e);
|
||||
// Will use default configuration if API fails
|
||||
@@ -882,8 +882,12 @@ function applyServerSettings(settings) {
|
||||
sections: tab.sections || undefined
|
||||
};
|
||||
});
|
||||
TAB_CONFIG.other = otherTab || { categories: [], singleSelect: false, label: 'Other' };
|
||||
// Rebuild ASSIGNED_CATEGORIES from the known (non-"other") tabs only,
|
||||
// before restoring .other — otherwise categories already parked in
|
||||
// .other (e.g. by loadCategoriesFromAPI) get counted as "assigned"
|
||||
// and immediately excluded from the "other" tab again.
|
||||
ASSIGNED_CATEGORIES = Object.values(TAB_CONFIG).flatMap(t => t.categories).map(c => ciStr(c));
|
||||
TAB_CONFIG.other = otherTab || { categories: [], singleSelect: false, label: 'Other' };
|
||||
}
|
||||
|
||||
// always_visible_tabs
|
||||
|
||||
Reference in New Issue
Block a user