Skip to content

fix: add auth loading state to prevent route flicker (#365)#507

Merged
indresh404 merged 1 commit into
indresh404:mainfrom
5hivam123:fix/auth-loading-state-flicker
Jun 14, 2026
Merged

fix: add auth loading state to prevent route flicker (#365)#507
indresh404 merged 1 commit into
indresh404:mainfrom
5hivam123:fix/auth-loading-state-flicker

Conversation

@5hivam123

Copy link
Copy Markdown
Contributor

Description

Added an AppContent inner component that uses useAuth hook
to check loading state before rendering AppRoutes. This
prevents route flicker and premature redirects to login page
while Firebase auth state is being resolved.

Changes:

  • Created AppContent component inside App.jsx that reads
    loading from useAuth()
  • Shows <Preloader /> while auth is loading
  • Renders <AppRoutes /> only after auth state is resolved
  • Also fixed duplicate hash fragment issue in redirect logic

Related Issue

Fixes #365

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Screenshots / Videos (if applicable)

[Add screen recording showing no flicker on page refresh]

Testing Done

  • Visual verification on local dev server (http://localhost:5173)
  • Refreshed page while logged in — no login page flash ✅
  • Auth state resolves correctly before routes render ✅
  • No console errors or warnings

Checklist

  • My code follows the style guidelines of this project.
  • I have performed a self-review of my own code.
  • My changes generate no new warnings or console errors.

Contributor Declaration

  • I confirm that this contribution is made under the rules of NSoC 2026.
  • I confirm that I have been assigned the related issue by a maintainer before opening this PR.
  • I have read the Contributing Guidelines and Code of Conduct.

@5hivam123 5hivam123 requested a review from indresh404 as a code owner June 14, 2026 06:13
@vercel

vercel Bot commented Jun 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ranker-hub Ready Ready Preview, Comment Jun 14, 2026 6:14am

@github-actions github-actions Bot added backend Backend/Firebase related changes bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request frontend Frontend related changes (HTML/CSS/JS/React) gssoc GirlScript Summer of Code gssoc26 GirlScript Summer of Code 2026 nsoc NSoC NSoC'26 NSoC 2026 pending-review PR is pending review labels Jun 14, 2026
@5hivam123

Copy link
Copy Markdown
Contributor Author

Hi @indresh404! 👋

I've fixed this issue.

Changes made in src/App.jsx:

  • Created AppContent inner component using useAuth hook
  • Added loading check — shows <Preloader /> while auth resolves
  • <AppRoutes /> renders only after auth state is confirmed
  • No more route flicker or premature login page redirect ✅

PR: [paste your PR link here]

Please review when you get a chance. Thanks! 🙏

@indresh404 indresh404 merged commit 74e9eff into indresh404:main Jun 14, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Backend/Firebase related changes bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request frontend Frontend related changes (HTML/CSS/JS/React) gssoc GirlScript Summer of Code gssoc26 GirlScript Summer of Code 2026 level3 nsoc NSoC NSoC'26 NSoC 2026 pending-review PR is pending review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: [Bug]: Missing loading state in AuthProvider causes route flicker on page load

2 participants