Skip to content

Commit 69a8eaa

Browse files
authored
Update fast-search-card.js
1 parent f36ec37 commit 69a8eaa

File tree

1 file changed

+32
-15
lines changed

1 file changed

+32
-15
lines changed

dist/fast-search-card.js

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11588,7 +11588,7 @@ class FastSearchCard extends HTMLElement {
1158811588
});
1158911589
}
1159011590

11591-
// 🎯 NAVIGATE TO ACTION DETAIL - Event-Simulation
11591+
// 🎯 NAVIGATE TO ACTION DETAIL - Event-Simulation mit Retry-Logik
1159211592
navigateToActionDetail(actionId, actionDomain) {
1159311593
console.log(`🎯 Simulating click on ${actionDomain}: ${actionId}`);
1159411594

@@ -11603,16 +11603,33 @@ class FastSearchCard extends HTMLElement {
1160311603
this.currentDetailItem = null;
1160411604
this.render();
1160511605

11606-
// 4. Warte bis gerendert, dann simuliere Klick
11607-
setTimeout(() => {
11608-
// 🔧 KORRIGIERT: Verwende die richtigen CSS-Selektoren
11609-
const viewMode = this.currentViewMode;
11610-
const itemSelector = viewMode === 'grid' ? '.device-card' : '.device-list-item';
11611-
const allItemsInView = this.shadowRoot.querySelectorAll(itemSelector);
11612-
11613-
console.log(`🔍 Looking for items with selector: ${itemSelector}`);
11614-
console.log(`🔍 Found ${allItemsInView.length} items in ${viewMode} view`);
11615-
11606+
// 4. Starte Retry-Logik
11607+
this.tryFindAndClickItem(actionId, 0);
11608+
}
11609+
11610+
// 🔄 RETRY LOGIC für Item-Suche
11611+
tryFindAndClickItem(actionId, attempt) {
11612+
const maxAttempts = 5;
11613+
11614+
// 🔧 KORRIGIERT: Verwende die richtigen CSS-Selektoren
11615+
const viewMode = this.currentViewMode;
11616+
const itemSelector = viewMode === 'grid' ? '.device-card' : '.device-list-item';
11617+
const allItemsInView = this.shadowRoot.querySelectorAll(itemSelector);
11618+
11619+
console.log(`🔄 Attempt ${attempt + 1}: Looking for items with selector: ${itemSelector}`);
11620+
console.log(`🔄 Attempt ${attempt + 1}: Found ${allItemsInView.length} items in ${viewMode} view`);
11621+
11622+
if (allItemsInView.length === 0 && attempt < maxAttempts) {
11623+
// Noch keine Items, nochmal versuchen
11624+
console.log(`⏳ No items found, retrying in 200ms...`);
11625+
setTimeout(() => {
11626+
this.tryFindAndClickItem(actionId, attempt + 1);
11627+
}, 200);
11628+
return;
11629+
}
11630+
11631+
// Items gefunden oder max attempts erreicht
11632+
if (allItemsInView.length > 0) {
1161611633
// 🔍 DEBUG: Schauen was verfügbar ist
1161711634
allItemsInView.forEach((item, index) => {
1161811635
console.log(`🔍 Item ${index}:`, {
@@ -11628,14 +11645,14 @@ class FastSearchCard extends HTMLElement {
1162811645
console.log(`🔍 Checking: ${itemId} === ${actionId}`);
1162911646

1163011647
if (itemId === actionId) {
11631-
console.log(`✅ Found item, simulating click`);
11648+
console.log(`✅ Found item after ${attempt + 1} attempts, simulating click`);
1163211649
item.click();
1163311650
return;
1163411651
}
1163511652
}
11636-
11637-
console.warn(`❌ Item not found for: ${actionId}`);
11638-
}, 200);
11653+
}
11654+
11655+
console.warn(`❌ Item not found for: ${actionId} after ${attempt + 1} attempts`);
1163911656
}
1164011657

1164111658
// 🎯 GET TARGET CATEGORY FOR DOMAIN

0 commit comments

Comments
 (0)