Repository navigation
fix(website): show loading feedback on Scan & Visualize - #1757
Shashankss1205 merged 1 commit into
Conversation
The Scan & Visualize button in the Client Indexer GitHub/GitLab tab only called navigate() to the Explore route, which does the actual fetch/index work. Nothing tracked an in-flight state for that click, so the button stayed enabled with no spinner or text change while waiting for the next page to render, and rapid clicks could queue multiple navigations. Wrap the navigate() call in useTransition so its pending flag drives disabled and a "Scanning repository..." spinner on the button, and guard the handler against re-entry while a scan is pending. A plain boolean was avoided because navigate() is synchronous (no await/finally to reset it on) and some paths (e.g. a route segment that skips auto-indexing, or the user pressing Back mid-load) never reach a success/error callback that could flip it back off — the transition's pending state always resolves on its own once navigation settles. Verified in headless Chrome against the dev server (home page and /explore, double-click, invalid input, Back mid-load, retry after a simulated failure) and confirmed no new tsc/eslint errors and a clean vite build. Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
@milinkanu is attempting to deploy a commit to the shashankss1205's projects Team on Vercel. A member of the Team first needs to authorize it. |
Shashankss1205
left a comment
There was a problem hiding this comment.
The change is scoped to LocalUploader and separates navigation pending state from the existing parse progress. Before merge, verify the transition actually stays pending across a delayed lazy Explore route and prevents duplicate navigation, then resets for Back/retry. The parent Explore loader still owns fetch/index progress; this should not imply that network indexing is finished when navigation commits. Please also run the currently awaiting CI workflows. Tracking the related acceptance in #1447; no automatic issue closure yet.
Shashankss1205
left a comment
There was a problem hiding this comment.
Re-tested the actual LocalUploader component under React 18 and a MemoryRouter with the same v7_startTransition setting as App. A deliberately unresolved lazy destination keeps the button disabled with the Scanning repository label; extra clicks do not navigate twice; resolving the route completes navigation; Back restores an enabled Scan & Visualize button. Production Vite build passes. This covers navigation pending state, while Explore continues to own actual fetch/index progress. Ready for merge after current integrated CI acceptance.
Problem
On the Client Indexer -> GitHub / GitLab tab, clicking Scan & Visualize gave no feedback. The button only called
navigate()to the/exploreroute, which does the actual fetch + index work in a separate page (Explore.tsx). Nothing inLocalUploader.tsxtracked an in-flight state for that click, so the button stayed enabled with unchanged text for the whole gap between click and the next page rendering. Rapid clicks could queue multiple navigations (confirmed: two clicks grew browser history by 2 entries instead of 1).Fix
Wrap the
navigate()call in React'suseTransition, and drive the button'sdisabledstate and a "Scanning repository..." spinner off its pending flag:useTransitionwas chosen over a plainisScanningboolean becausenavigate()is synchronous (no promise toawait/finallyon), and some paths never reach a success/error callback that could reset a manual flag — e.g. a route segment that causesExploreto skip auto-indexing, or the user pressing Back while the lazyExplorechunk is still loading. The transition's pending state always resolves itself once navigation settles, so the button can't get stuck disabled.Also added a re-entry guard (
if (isScanning) return;) at the top of the handler as defense in depth alongside the disabled button.This only touches
website/src/components/LocalUploader.tsx(16 lines added / 4 changed). No backend/API or fetch/index logic was touched, and the existing success/error handling inExplore.tsx(loader, error screen with Retry) is unchanged.Testing
/explorepage, double-click, invalid/empty input, a route segment that skips auto-indexing, pressing Back mid-load, and retry after a simulated fetch failure. Button now disables immediately and shows the spinner in every case, and re-enables correctly after both success and failure paths.tsc --noEmit: same pre-existing errors elsewhere in the website package, none in this file.eslinton the changed file: same pre-existing errors (unrelatedanyusages etc.), no new ones.vite build: passes.website/(no vitest/testing-library configured), so no automated test was added for this UI-only change.🤖 Generated with Claude Code