Skip to content

fix: reset search loading state after navigation#38

Open
pragnyanramtha wants to merge 1 commit into
imrohan18:mainfrom
pragnyanramtha:fix-searchform-loading-state
Open

fix: reset search loading state after navigation#38
pragnyanramtha wants to merge 1 commit into
imrohan18:mainfrom
pragnyanramtha:fix-searchform-loading-state

Conversation

@pragnyanramtha
Copy link
Copy Markdown

Summary

  • replace the manual isLoading flag with React transition pending state for search navigation
  • keep the submit button disabled only during the active route transition
  • preserve an accessible pending label while the spinner is shown

Closes #32.

Tests

  • npx eslint app/components/SearchForm.tsx
  • npm run build
  • git diff --check

Note: full npm run lint still fails on pre-existing unrelated lint errors in about/page.tsx, PriceMap.tsx, contact/page.tsx, page.tsx, search/page.tsx, proxy.ts, and utils/supabase/middleware.ts.

Copilot AI review requested due to automatic review settings May 19, 2026 20:02
@vercel
Copy link
Copy Markdown

vercel Bot commented May 19, 2026

@pragnyanramtha is attempting to deploy a commit to the rohanhake256's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Replaces the manual isLoading state in SearchForm with React's useTransition so the pending state is automatically cleared once navigation completes, fixing the stuck spinner bug described in #32. Also tightens the disabled state logic and adds accessible labels for the pending state.

Changes:

  • Swap useState loading flag for useTransition's isPending and wrap router.push in startTransition.
  • Derive trimmedQuery/canSearch/isSearchEnabled once and reuse for guard, disabled, and styling logic.
  • Add aria-label and sr-only "Searching" text alongside the spinner for accessibility.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] SearchForm loading state never resets after navigation

2 participants