fix: split login page for Steward-only auth + Privy mock context#448
fix: split login page for Steward-only auth + Privy mock context#448
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
When NEXT_PUBLIC_STEWARD_AUTH_ENABLED is true and no valid Privy app ID is configured, render PrivyProviderReactAuth with a dummy app ID instead of bare fragments. This gives child components calling usePrivy() a valid context (returning unauthenticated defaults) rather than throwing due to missing provider. Co-authored-by: wakesync <shadow@shad0w.xyz>
When NEXT_PUBLIC_STEWARD_AUTH_ENABLED=true and no Privy app ID is set,
the login page now loads only the Steward login section via next/dynamic.
Privy hooks (usePrivy, useLogin, etc.) are never imported or executed.
- Created steward-login-section.tsx: self-contained StewardProvider + StewardLogin
- Created privy-login-section.tsx: all Privy hooks and OAuth/email/wallet logic
- Rewrote page.tsx: env-based conditional rendering with dynamic(() => import(), { ssr: false })
- Three modes: steward-only, both (steward first + divider + privy), privy-only (default)
Co-authored-by: wakesync <shadow@shad0w.xyz>
402ac43 to
201bee5
Compare
Code ReviewThe refactoring approach is sound — using Bug: Unused import in
|
Summary
Fixes the login page hanging when Steward auth is enabled without Privy credentials.
Changes
1. Split login page into isolated components
steward-login-section.tsx— Self-contained steward auth (passkey + email). Zero Privy imports.privy-login-section.tsx— All existing Privy code moved here. Loaded vianext/dynamicwithssr: false.page.tsx— Slim orchestrator with 3 modes: steward-only, both, privy-only.2. Privy mock context
When
NEXT_PUBLIC_STEWARD_AUTH_ENABLED=trueand Privy isn't configured, PrivyProvider wraps children with a dummy app ID sousePrivy()hooks return{ready: true, authenticated: false}instead of hanging.Why
The login page imported
usePrivy,useLogin,useLoginWithEmail,useLoginWithOAuthat the top level. Without a configured Privy app ID, these hooks hang forever showing a loading spinner. Now the Privy section is dynamically imported and never loaded when unconfigured.Breaking Changes
Follows #446 and #447.
Co-authored-by: wakesync shadow@shad0w.xyz