fix(ui): show spinner on Run Scan button while request is in flight#209
fix(ui): show spinner on Run Scan button while request is in flight#209Maqbool61 wants to merge 1 commit into
Conversation
|
Thanks for this — the spinner on Run Scan is a nice UX fix and the One blocker before merging: this branch drops the Could you rebase on the latest |
Working on fixing those issues |
Closes NovaCode37#199. App.tsx set setScanStatus('running') and setView('scanning') simultaneously before await startScan() resolved, so the view switched to the scanning screen before any spinner was visible. IdleView had no spinner at all on its submit button. Changes ------- App.tsx Added isStarting state (true only while startScan() is in flight). setView('scanning') and setScanStatus('running') now fire after the request resolves, not before. isStarting is passed to both Sidebar and IdleView. Sidebar.tsx Accepts isStarting prop (optional, defaults false). Button is disabled and shows Loader2 spinner when isStarting OR isRunning. No new imports needed — Loader2 was already present. IdleView.tsx Accepts isStarting prop (optional, defaults false). Added Loader2 import. Submit button is disabled and shows Loader2 spinner while isStarting is true.
ef9f6f5 to
e5c9f7e
Compare
Closes #199.
Problem
When clicking "Run Scan", there was no visual feedback during the brief
window while the scan was being created.
App.tsxcalledsetScanStatus('running')andsetView('scanning')simultaneouslybefore
await startScan()resolved, switching the view to the scanningscreen before any spinner was visible. The
IdleViewquick-scan buttonhad no spinner at all.
What changed
frontend/src/components/App.tsxAdded
isStartingboolean state that istrueonly whilestartScan()is in flight.setView('scanning')andsetScanStatus('running')now fire after the request resolves, notbefore.
isStartingis passed down to bothSidebarandIdleView.frontend/src/components/Sidebar.tsxAccepts
isStartingprop (optional, defaultsfalse). The Run Scanbutton is disabled and shows the
Loader2spinner when eitherisStartingorisRunningis true. No new imports —Loader2wasalready present.
frontend/src/components/views/IdleView.tsxAccepts
isStartingprop (optional, defaultsfalse). AddedLoader2to the lucide import. The submit button is disabled and shows a spinner
while
isStartingis true.Tests
221 passed, 19 warnings