Fix critical startup freeze when no images loaded

Root cause fix:
- startGame() was calling showScreen('image-management-screen') directly
- This bypassed setupImageManagementEventListeners() and loadImageGallery()
- Changed to call showImageManagement() instead which properly initializes the screen
- showImageManagement() sets up all event listeners and loads gallery correctly

Issue sequence:
1. App starts with no images
2. User immediately clicks 'Start Game'
3. startGame() detects no images available
4. Called showScreen() directly  No event listeners  Freeze
5. Now calls showImageManagement()  Full setup  Works perfectly

Fix tested scenario:
- Start app  Navigate to manage images  Back home  Start game  (was working)
- Start app  Immediately click Start game  (now fixed - was freezing)

The freeze only happened on immediate startup because the screen wasn't properly initialized.
This commit is contained in:
fritzsenpai 2025-09-25 21:10:12 -05:00
parent 3d949fe08c
commit 205fbc1186
1 changed files with 1 additions and 1 deletions

View File

@ -1837,7 +1837,7 @@ ${usagePercent > 85 ? '⚠️ Storage getting full - consider deleting some imag
if (totalImages === 0 && customImageCount === 0) {
// No images available - guide user to add images
this.showNotification('No images found! Please upload images or scan directories first.', 'error', 5000);
this.showScreen('image-management-screen');
this.showImageManagement(); // Use the proper method that sets up event listeners
return;
}