Skip to content

Commit d083add

Browse files
authored
Update fast-search-card.js
1 parent 705e1ca commit d083add

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

β€Ždist/fast-search-card.jsβ€Ž

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -424,25 +424,24 @@ class FastSearchCard extends HTMLElement {
424424

425425
console.log('πŸ› DEBUG: set hass called');
426426
console.log('πŸ› DEBUG: oldHass exists:', !!oldHass);
427-
console.log('πŸ› DEBUG: user is admin:', hass.user?.is_admin);
428-
console.log('πŸ› DEBUG: user info:', hass.user);
429-
430-
// NEU: Auto-Setup beim ersten Start (nur fΓΌr Admins)
431-
if (!oldHass && hass && hass.user?.is_admin) {
432-
console.log('πŸ› DEBUG: Taking ADMIN path');
433-
this.autoCreateUserLabels().then(() => {
427+
console.log('πŸ› DEBUG: favoritesLoaded:', this.favoritesLoaded);
428+
429+
// NEU: Favoriten laden wenn noch nicht geladen
430+
if (!this.favoritesLoaded) {
431+
console.log('πŸ› DEBUG: Loading favorites (not loaded yet)');
432+
if (hass.user?.is_admin) {
433+
this.autoCreateUserLabels().then(() => {
434+
this.loadAllFavorites().then(() => {
435+
this.updateItems();
436+
});
437+
});
438+
} else {
434439
this.loadAllFavorites().then(() => {
435440
this.updateItems();
436441
});
437-
});
438-
} else if (!oldHass && hass) {
439-
console.log('πŸ› DEBUG: Taking NORMAL USER path');
440-
// Normaler User - nur Favoriten laden
441-
this.loadAllFavorites().then(() => {
442-
this.updateItems();
443-
});
442+
}
444443
} else {
445-
console.log('πŸ› DEBUG: Taking ELSE path (no favorites loading)');
444+
// Favoriten bereits geladen, normale Updates
446445
const shouldUpdateAll = !oldHass || this.shouldUpdateItems(oldHass, hass);
447446
if (shouldUpdateAll) {
448447
this.updateItems();

0 commit comments

Comments
Β (0)