Fix: Fehler beim Laden wenn Kacheln ausgeblendet sind

_applyLayout entfernte Widgets ohne die Card-Elemente vorher zu parken.
Beim Wiederherstellen eines Layouts mit versteckten Kacheln (z.B. Timeline)
gingen die DOM-Elemente verloren, was zu null-Referenz-Fehlern fuehrte.

Fixes:
- layout.js: Cards in tile-parking retten bevor Widget entfernt wird
- app.js: Null-Guards in rerenderTimeline und _updateTimelineCount
Dieser Commit ist enthalten in:
Claude Dev
2026-03-24 07:34:56 +01:00
Ursprung c7d7bbbb18
Commit d274ec237b
2 geänderte Dateien mit 12 neuen und 1 gelöschten Zeilen

Datei anzeigen

@@ -960,6 +960,7 @@ const App = {
const articleCount = entries.filter(e => e.kind === 'article').length; const articleCount = entries.filter(e => e.kind === 'article').length;
const snapshotCount = entries.filter(e => e.kind === 'snapshot').length; const snapshotCount = entries.filter(e => e.kind === 'snapshot').length;
const countEl = document.getElementById('article-count'); const countEl = document.getElementById('article-count');
if (!countEl) return;
if (articleCount > 0 && snapshotCount > 0) { if (articleCount > 0 && snapshotCount > 0) {
countEl.innerHTML = `<span class="ht-legend-dot"></span> ${articleCount} Meldung${articleCount !== 1 ? 'en' : ''} + <span class="ht-legend-dot ht-legend-gold"></span> ${snapshotCount} Lagebericht${snapshotCount !== 1 ? 'e' : ''}`; countEl.innerHTML = `<span class="ht-legend-dot"></span> ${articleCount} Meldung${articleCount !== 1 ? 'en' : ''} + <span class="ht-legend-dot ht-legend-gold"></span> ${snapshotCount} Lagebericht${snapshotCount !== 1 ? 'e' : ''}`;
} else if (articleCount > 0) { } else if (articleCount > 0) {
@@ -978,7 +979,8 @@ const App = {
rerenderTimeline() { rerenderTimeline() {
const container = document.getElementById('timeline'); const container = document.getElementById('timeline');
const searchTerm = (document.getElementById('timeline-search').value || '').toLowerCase(); if (!container) return;
const searchTerm = (document.getElementById('timeline-search')?.value || '').toLowerCase();
const filterType = this._timelineFilter; const filterType = this._timelineFilter;
const range = this._timelineRange; const range = this._timelineRange;

Datei anzeigen

@@ -70,6 +70,15 @@ const LayoutManager = {
if (item.visible === false) { if (item.visible === false) {
this._hiddenTiles[item.id] = item; this._hiddenTiles[item.id] = item;
// Card in tile-parking retten bevor Widget entfernt wird
const selector = this.TILE_MAP[item.id];
if (selector) {
const cardEl = el.el.querySelector(selector);
if (cardEl) {
const parking = document.getElementById("tile-parking");
if (parking) parking.appendChild(cardEl);
}
}
this._grid.removeWidget(el.el, true, false); this._grid.removeWidget(el.el, true, false);
} else { } else {
this._grid.update(el.el, { x: item.x, y: item.y, w: item.w, h: item.h }); this._grid.update(el.el, { x: item.x, y: item.y, w: item.w, h: item.h });