fix(ui): log-fallback warning is a toast, not a blocking alert()
alert() in Electron halts the renderer main thread until the user clicks OK — the upload table, status bar and progress all freeze. During a 170-file batch the dialog popped up mid-upload and froze everything for however long the user took to dismiss it (which is why stats updates lagged to one every 3-5s instead of the usual 1s cadence). Replaced with the same showCopyToast used elsewhere, with an 8s duration so the message is still readable. showCopyToast now accepts an optional durationMs argument.
This commit is contained in:
parent
7a5278012b
commit
c5c31aa323
@ -118,7 +118,11 @@ async function init() {
|
||||
});
|
||||
window.api.onShutdownCountdown(handleShutdownCountdown);
|
||||
window.api.onUploadLogFallback((data) => {
|
||||
alert('Der konfigurierte Log-Pfad konnte nicht beschrieben werden.\n\nNeue Einträge werden zwischenzeitlich hier gespeichert:\n' + (data && data.fallbackPath ? data.fallbackPath : '(Fallback)') + '\n\nBitte in den Einstellungen einen gültigen Pfad setzen.');
|
||||
// Non-blocking toast instead of alert() — alert() in Electron halts the
|
||||
// entire renderer main thread (including the upload table) until the user
|
||||
// clicks OK. During a big batch that freezes everything.
|
||||
const path = data && data.fallbackPath ? data.fallbackPath : '(Fallback)';
|
||||
showCopyToast(`Log-Pfad nicht beschreibbar — schreibe nach: ${path}`, 8000);
|
||||
});
|
||||
window.api.onAccountRotationLog((entry) => {
|
||||
// Surface only the user-visible rotation events as toasts; full detail
|
||||
@ -3891,12 +3895,12 @@ function escapeAttr(str) {
|
||||
return String(str).replace(_ATTR_ESC_RE, (c) => _ATTR_ESC_MAP[c]);
|
||||
}
|
||||
|
||||
function showCopyToast(msg) {
|
||||
function showCopyToast(msg, durationMs) {
|
||||
const toast = document.getElementById('copyToast');
|
||||
toast.textContent = msg;
|
||||
toast.classList.add('show');
|
||||
clearTimeout(toast._timer);
|
||||
toast._timer = setTimeout(() => toast.classList.remove('show'), 1500);
|
||||
toast._timer = setTimeout(() => toast.classList.remove('show'), durationMs || 1500);
|
||||
}
|
||||
|
||||
// --- Resize handle for recent-files panel ---
|
||||
|
||||
Loading…
Reference in New Issue
Block a user