fix(live): preserve channels after empty projection rebuild (#18)

Treat successful but empty live projections with existing live input as stale, reject them on the frontend, and keep the previous visible channel state during rebuild failures.

Add DOM coverage for the Settings analysis flow and backend serialization coverage for empty projection state.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
blomios
2026-10-05 22:30:37 +02:00
parent 6dfd2ba093
commit 6bb1914906
7 changed files with 844 additions and 14 deletions

View File

@ -906,6 +906,13 @@ class ChannelList {
this.isLoading = true;
this.currentRenderId = null; // Reset render tracking
const previousState = {
channels: this.channels,
groups: this.groups,
visibleFavorites: this.visibleFavorites,
hiddenItems: this.hiddenItems
};
const sourceValue = this.sourceSelect.value;
const self = this;
@ -943,7 +950,15 @@ class ChannelList {
void this.refreshLayaLanguages();
} catch (err) {
console.error('Error loading channels:', err);
this.container.innerHTML = `<div class="empty-state"><p>Error loading channels</p><p class="hint">${err.message}</p></div>`;
if (previousState.channels.length > 0) {
this.channels = previousState.channels;
this.groups = previousState.groups;
this.visibleFavorites = previousState.visibleFavorites;
this.hiddenItems = previousState.hiddenItems;
this.render();
} else {
this.container.innerHTML = `<div class="empty-state"><p>Error loading channels</p><p class="hint">${err.message}</p></div>`;
}
} finally {
this.isLoading = false;
}
@ -953,6 +968,12 @@ class ChannelList {
* Load channels from all enabled sources
*/
async loadAllChannels() {
const previousState = {
channels: this.channels,
groups: this.groups,
visibleFavorites: this.visibleFavorites,
hiddenItems: this.hiddenItems
};
this.channels = [];
this.groups = [];
@ -985,6 +1006,15 @@ class ChannelList {
void this.refreshLayaLanguages();
} catch (err) {
console.error('Error loading all channels:', err);
if (previousState.channels.length > 0) {
this.channels = previousState.channels;
this.groups = previousState.groups;
this.visibleFavorites = previousState.visibleFavorites;
this.hiddenItems = previousState.hiddenItems;
this.render();
} else {
this.container.innerHTML = `<div class="empty-state"><p>Error loading channels</p><p class="hint">${err.message}</p></div>`;
}
}
}