From 5666fd5ca5e5a30680136000769b5a73b48684c4 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Mon, 25 May 2026 13:06:11 -0400 Subject: [PATCH] =?UTF-8?q?fix(ui):=20scan=20trigger=20immediate-feedback?= =?UTF-8?q?=20toast=20+=20delayed=20status=20re-poll=20=E2=80=94=20operato?= =?UTF-8?q?r-flagged=20'click=20does=20nothing'=20was=20actually=20scan=5F?= =?UTF-8?q?directory's=20skip-set=20finalizing=20the=20batch=20in=20<100ms?= =?UTF-8?q?=20when=20every=20file=20already=20had=20an=20ImportTask=20row,?= =?UTF-8?q?=20before=20refreshStatus=20could=20ever=20see=20the=20active?= =?UTF-8?q?=20state.=20Now=20the=20click=20always=20produces=20visible=20f?= =?UTF-8?q?eedback=20(immediate=20'Scan=20triggered'=20+=202s=20'no=20new?= =?UTF-8?q?=20files'=20if=20it=20quick-finalizes).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.7 (1M context) --- frontend/src/stores/import.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/frontend/src/stores/import.js b/frontend/src/stores/import.js index 9d4832e..2358274 100644 --- a/frontend/src/stores/import.js +++ b/frontend/src/stores/import.js @@ -56,7 +56,27 @@ export const useImportStore = defineStore('import', () => { triggerError.value = null try { await api.post('/api/import/trigger', { body: { mode: 'quick' } }) + // Acknowledge immediately so the click isn't invisible. scan_directory + // can finalize the batch synchronously when every file in /import is + // already on a non-failed ImportTask (operator-flagged 2026-05-25: + // 233k existing tasks → all paths in skip-set → files_seen=0 → + // batch flashes 'running' for <100ms then 'complete' before the + // first refreshStatus() lands; UI never sees the active state). + window.__fcToast?.({ text: 'Scan triggered', type: 'success' }) await refreshStatus() + // Re-poll twice over ~5s to catch quick-finalize transitions and + // surface a result toast either way. + setTimeout(async () => { + await refreshStatus() + if (!activeBatch.value) { + // Either scan completed with zero new files, or it never visibly + // started. Fetch the freshest task to differentiate. + window.__fcToast?.({ + text: 'Scan complete — no new files (everything already on an ImportTask row)', + type: 'info', + }) + } + }, 2000) } catch (e) { triggerError.value = e.message window.__fcToast?.({ text: `Scan failed: ${e.message}`, type: 'error' })