From 955759a4cda29e42557cb78ccddd718ac355af2c Mon Sep 17 00:00:00 2001 From: awsr <43862868+awsr@users.noreply.github.com> Date: Tue, 2 Dec 2025 19:26:30 -0800 Subject: [PATCH] Set minimum display time for message --- javascript/gallery.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/javascript/gallery.js b/javascript/gallery.js index ec7908d6e..e4c64c3af 100644 --- a/javascript/gallery.js +++ b/javascript/gallery.js @@ -711,6 +711,7 @@ async function thumbCacheCleanup(folder, imgCount, controller) { return; } const cb_clearMsg = showCleaningMsg(cleanupCount); + const tRun = Date.now(); // Doesn't need high resolution await idbFolderCleanup(staticGalleryHashes, folder, controller.signal) .then((delcount) => { const t1 = performance.now(); @@ -723,7 +724,11 @@ async function thumbCacheCleanup(folder, imgCount, controller) { error('Thumbnail DB cleanup:', reason.message); } }) - .finally(() => { + .finally(async () => { + // Ensure at least enough time to see that it's a message and not the UI breaking/flickering + await new Promise((resolve) => { + setTimeout(resolve, Math.min(1000, Math.max(1000 - (Date.now() - tRun), 0))); // Total display time of at least 1 second + }); cb_clearMsg(); }); },