fix: improve UI refresh timing after force-stop recovery
- Increase recovery delay from 1s to 3s (force-stop recovery can take time) - Add immediate refresh + delayed refresh to catch recovery at different stages - Better error handling for database not ready yet (shows 'Checking...' instead of error) - Add logging to indicate when config not found is normal (after uninstall/reinstall) Previously, after force-stop recovery: - Configuration check happened too early (1s delay not enough) - UI showed error immediately if database not ready - Single refresh might miss recovery completion The fix: - Immediate refresh when app becomes visible (catches fast recovery) - Delayed refresh after 3 seconds (catches slower recovery) - Better error messages indicating database might not be ready yet - Note that config not found is normal after uninstall/reinstall (database wiped) This ensures UI properly refreshes configuration status and notification info after force-stop recovery completes.
This commit is contained in:
@@ -381,7 +381,8 @@
|
||||
fetcherStatus.innerHTML = '❌ Error';
|
||||
}
|
||||
} else {
|
||||
console.log('[Config Check] ❌ Native fetcher config not found');
|
||||
console.log('[Config Check] ❌ Native fetcher config not found in database');
|
||||
console.log('[Config Check] This may be normal after app uninstall/reinstall (database wiped)');
|
||||
fetcherStatus.innerHTML = '❌ Not configured';
|
||||
}
|
||||
|
||||
@@ -395,8 +396,15 @@
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('[Config Check] Failed to check configuration:', error);
|
||||
configStatus.innerHTML = '❌ Error';
|
||||
fetcherStatus.innerHTML = '❌ Error';
|
||||
// Don't show error if database might not be ready yet (recovery in progress)
|
||||
if (error.message && error.message.includes('database')) {
|
||||
console.log('[Config Check] Database may not be ready yet, will retry...');
|
||||
fetcherStatus.innerHTML = '⏳ Checking...';
|
||||
configStatus.innerHTML = '⏳ Checking...';
|
||||
} else {
|
||||
configStatus.innerHTML = '❌ Error';
|
||||
fetcherStatus.innerHTML = '❌ Error';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -650,8 +658,15 @@
|
||||
document.addEventListener('visibilitychange', () => {
|
||||
if (!document.hidden) {
|
||||
console.log('[Visibility] App became visible, refreshing UI status...');
|
||||
// Small delay to allow recovery to complete
|
||||
// Longer delay to allow recovery to complete (force-stop recovery can take a few seconds)
|
||||
// Also refresh immediately, then again after delay to catch any late recovery
|
||||
loadPluginStatus();
|
||||
loadPermissionStatus();
|
||||
loadChannelStatus();
|
||||
loadConfigurationStatus();
|
||||
|
||||
setTimeout(() => {
|
||||
console.log('[Visibility] Delayed refresh after recovery period...');
|
||||
loadPluginStatus();
|
||||
loadPermissionStatus();
|
||||
loadChannelStatus();
|
||||
@@ -692,7 +707,7 @@
|
||||
console.error('[Visibility] Failed to get notification status:', error);
|
||||
});
|
||||
}
|
||||
}, 1000); // Wait 1 second for recovery to complete
|
||||
}, 3000); // Wait 3 seconds for recovery to complete (force-stop recovery can take time)
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user