Spaces:
Paused
Paused
Fix: Add missing render call after news generation polling and check for empty topics
Browse files- src/views/news/news-view.js +12 -0
src/views/news/news-view.js
CHANGED
|
@@ -380,6 +380,11 @@ export class NewsView {
|
|
| 380 |
if (triggerBtn) {
|
| 381 |
triggerBtn.addEventListener('click', async () => {
|
| 382 |
if (this.isGenerating) return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 383 |
this.isGenerating = true;
|
| 384 |
triggerBtn.textContent = 'Generiere (das kann 10-20 Sekunden dauern)...';
|
| 385 |
triggerBtn.style.opacity = '0.5';
|
|
@@ -394,6 +399,7 @@ export class NewsView {
|
|
| 394 |
if (this.articles.length > 0 || attempts >= 6) {
|
| 395 |
clearInterval(pollInterval);
|
| 396 |
this.isGenerating = false;
|
|
|
|
| 397 |
}
|
| 398 |
}, 5000);
|
| 399 |
});
|
|
@@ -403,6 +409,11 @@ export class NewsView {
|
|
| 403 |
if (simBtn) {
|
| 404 |
simBtn.addEventListener('click', async () => {
|
| 405 |
if (this.isGenerating) return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 406 |
this.isGenerating = true;
|
| 407 |
simBtn.textContent = 'Generiere... (Simulated Error) - Bitte warten...';
|
| 408 |
simBtn.style.opacity = '0.5';
|
|
@@ -416,6 +427,7 @@ export class NewsView {
|
|
| 416 |
if (this.articles.length > 0 || attempts >= 8) { // 40 seconds max for fallback
|
| 417 |
clearInterval(pollInterval);
|
| 418 |
this.isGenerating = false;
|
|
|
|
| 419 |
}
|
| 420 |
}, 5000);
|
| 421 |
});
|
|
|
|
| 380 |
if (triggerBtn) {
|
| 381 |
triggerBtn.addEventListener('click', async () => {
|
| 382 |
if (this.isGenerating) return;
|
| 383 |
+
if (this.topics.length === 0) {
|
| 384 |
+
alert('Bitte füge zuerst oben rechts über das ⚙️ Icon mindestens ein Thema hinzu!');
|
| 385 |
+
return;
|
| 386 |
+
}
|
| 387 |
+
|
| 388 |
this.isGenerating = true;
|
| 389 |
triggerBtn.textContent = 'Generiere (das kann 10-20 Sekunden dauern)...';
|
| 390 |
triggerBtn.style.opacity = '0.5';
|
|
|
|
| 399 |
if (this.articles.length > 0 || attempts >= 6) {
|
| 400 |
clearInterval(pollInterval);
|
| 401 |
this.isGenerating = false;
|
| 402 |
+
this.render(); // WICHTIG: UI aktualisieren
|
| 403 |
}
|
| 404 |
}, 5000);
|
| 405 |
});
|
|
|
|
| 409 |
if (simBtn) {
|
| 410 |
simBtn.addEventListener('click', async () => {
|
| 411 |
if (this.isGenerating) return;
|
| 412 |
+
if (this.topics.length === 0) {
|
| 413 |
+
alert('Bitte füge zuerst oben rechts über das ⚙️ Icon mindestens ein Thema hinzu!');
|
| 414 |
+
return;
|
| 415 |
+
}
|
| 416 |
+
|
| 417 |
this.isGenerating = true;
|
| 418 |
simBtn.textContent = 'Generiere... (Simulated Error) - Bitte warten...';
|
| 419 |
simBtn.style.opacity = '0.5';
|
|
|
|
| 427 |
if (this.articles.length > 0 || attempts >= 8) { // 40 seconds max for fallback
|
| 428 |
clearInterval(pollInterval);
|
| 429 |
this.isGenerating = false;
|
| 430 |
+
this.render(); // WICHTIG: UI aktualisieren
|
| 431 |
}
|
| 432 |
}, 5000);
|
| 433 |
});
|