wishlist modal bug fix
This commit is contained in:
parent
abbb93f053
commit
eaa27038d9
1 changed files with 29 additions and 28 deletions
|
|
@ -2505,40 +2505,41 @@ async function rehydrateModal(processInfo, userRequested = false) {
|
||||||
|
|
||||||
console.log(`✅ [Rehydrate] Successfully updated existing wishlist modal for auto-process`);
|
console.log(`✅ [Rehydrate] Successfully updated existing wishlist modal for auto-process`);
|
||||||
} else {
|
} else {
|
||||||
console.log(`💧 [Rehydrate] Creating new wishlist modal for active process: ${batch_id}`);
|
// Only create modal if user requested it - don't create for background auto-processing
|
||||||
|
|
||||||
// Create the modal with current server state
|
|
||||||
await openDownloadMissingWishlistModal();
|
|
||||||
const process = activeDownloadProcesses[playlist_id];
|
|
||||||
if (!process) {
|
|
||||||
console.error('❌ [Rehydrate] Failed to create wishlist process in activeDownloadProcesses');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sync process state with server
|
|
||||||
console.log(`✅ [Rehydrate] Syncing wishlist process state - batchId: ${batch_id}, status: running`);
|
|
||||||
process.status = 'running';
|
|
||||||
process.batchId = batch_id;
|
|
||||||
|
|
||||||
// Update UI to reflect running state
|
|
||||||
const beginBtn = document.getElementById(`begin-analysis-btn-${playlist_id}`);
|
|
||||||
const cancelBtn = document.getElementById(`cancel-all-btn-${playlist_id}`);
|
|
||||||
if (beginBtn) beginBtn.style.display = 'none';
|
|
||||||
if (cancelBtn) cancelBtn.style.display = 'inline-block';
|
|
||||||
|
|
||||||
// Start polling for live updates
|
|
||||||
startModalDownloadPolling(playlist_id);
|
|
||||||
|
|
||||||
// SIMPLIFIED VISIBILITY LOGIC: Show modal if user requested it, otherwise keep hidden for background sync
|
|
||||||
if (userRequested) {
|
if (userRequested) {
|
||||||
|
console.log(`💧 [Rehydrate] User requested - creating wishlist modal for active process: ${batch_id}`);
|
||||||
|
|
||||||
|
// Create the modal with current server state
|
||||||
|
await openDownloadMissingWishlistModal();
|
||||||
|
const process = activeDownloadProcesses[playlist_id];
|
||||||
|
if (!process) {
|
||||||
|
console.error('❌ [Rehydrate] Failed to create wishlist process in activeDownloadProcesses');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sync process state with server
|
||||||
|
console.log(`✅ [Rehydrate] Syncing wishlist process state - batchId: ${batch_id}, status: running`);
|
||||||
|
process.status = 'running';
|
||||||
|
process.batchId = batch_id;
|
||||||
|
|
||||||
|
// Update UI to reflect running state
|
||||||
|
const beginBtn = document.getElementById(`begin-analysis-btn-${playlist_id}`);
|
||||||
|
const cancelBtn = document.getElementById(`cancel-all-btn-${playlist_id}`);
|
||||||
|
if (beginBtn) beginBtn.style.display = 'none';
|
||||||
|
if (cancelBtn) cancelBtn.style.display = 'inline-block';
|
||||||
|
|
||||||
|
// Start polling for live updates
|
||||||
|
startModalDownloadPolling(playlist_id);
|
||||||
|
|
||||||
|
// Show modal
|
||||||
console.log('👤 [Rehydrate] User requested - showing wishlist modal');
|
console.log('👤 [Rehydrate] User requested - showing wishlist modal');
|
||||||
process.modalElement.style.display = 'flex';
|
process.modalElement.style.display = 'flex';
|
||||||
WishlistModalState.setVisible();
|
WishlistModalState.setVisible();
|
||||||
WishlistModalState.clearUserClosed();
|
WishlistModalState.clearUserClosed();
|
||||||
} else {
|
} else {
|
||||||
console.log('🔄 [Rehydrate] Background sync - keeping modal hidden until user interaction');
|
console.log('🔄 [Rehydrate] Background auto-processing detected - NOT creating modal (user must click wishlist button to see progress)');
|
||||||
process.modalElement.style.display = 'none';
|
// Don't create modal for background auto-processing
|
||||||
WishlistModalState.setHidden();
|
// User must click the wishlist button to see the modal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue