Fix: Klick auf aktiven Hund im Picker lädt Inhalt (setActiveDog war no-op)

This commit is contained in:
rene 2026-04-13 19:55:42 +02:00
parent e59b6e6e88
commit c06d9e24a7
3 changed files with 19 additions and 6 deletions

View file

@ -118,9 +118,14 @@ window.Page_diary = (() => {
_container.querySelectorAll('.diary-picker-card').forEach(el => {
el.addEventListener('click', async () => {
const id = parseInt(el.dataset.dogId);
App.setActiveDog(id);
// onDogChange() wird durch setActiveDog → _notifyDogChange() aufgerufen
// → lädt Diary direkt
if (id === _appState.activeDog?.id) {
// Bereits aktiver Hund → direkt Diary laden
_offset = 0; _entries = [];
await _renderDiary();
} else {
App.setActiveDog(id);
// onDogChange() → _renderDiary() via _notifyDogChange()
}
});
});
}

View file

@ -96,8 +96,16 @@ window.Page_health = (() => {
</div>`;
_container.querySelectorAll('.diary-picker-card').forEach(el => {
el.addEventListener('click', () => {
App.setActiveDog(parseInt(el.dataset.dogId));
el.addEventListener('click', async () => {
const id = parseInt(el.dataset.dogId);
if (id === _appState.activeDog?.id) {
// Bereits aktiver Hund → direkt Health laden
_data = {};
await _renderHealth();
} else {
App.setActiveDog(id);
// onDogChange() → _renderHealth() via _notifyDogChange()
}
});
});
}

View file

@ -3,7 +3,7 @@
Offline-Cache + Push Notifications
============================================================ */
const CACHE_VERSION = 'by-v5';
const CACHE_VERSION = 'by-v6';
const CACHE_STATIC = `${CACHE_VERSION}-static`;
// Diese Dateien werden beim Install gecacht (App Shell)