Skip to content

Fix Navbar loading-state flashes and multi-role rendering logic #48

Closed

Description

@chonilius

Problem

src/components/layout/Navbar.tsx almost certainly renders role-dependent navigation (contributor/maintainer/sponsor dashboards, per UserRole in src/types/index.ts, plus the connect-wallet/connect-GitHub CTAs) and needs to reflect useAuth()'s user/loading state and useWallet()'s connection state correctly across every combination: logged out, logged in with no roles yet assigned, logged in with multiple roles (can a single AuthUser.roles: UserRole[] array hold more than one role simultaneously — e.g. someone who's both a maintainer and a sponsor? the type suggests yes), wallet connected vs. not, and the loading transitions between all of these on initial page load (since AuthContext's loading starts true and WalletContext has its own async initialization). A component this state-matrix-heavy is a prime location for rendering the wrong nav items during the loading window (e.g. briefly flashing "Connect GitHub" before AuthContext resolves an existing session, then flashing again to the logged-in state) or for incorrectly assuming a user has exactly one role when UserRole[] allows multiple, leading to a maintainer-and-sponsor user only ever seeing one of their two applicable dashboard links.

Why this is hard

  • Requires reading Navbar.tsx's actual current conditional-rendering logic in full to find every place it branches on user, loading, wallet address, and role membership, since this is exactly the kind of logic that accretes special cases over time and is easy to get subtly wrong without a systematic audit.
  • The multi-role case needs a real UX decision, not just a bug fix: if roles contains both "maintainer" and "sponsor", does the nav show both dashboard links, a role switcher, or default to one with a way to access the other? This requires making and implementing a deliberate choice given the type system explicitly allows it, rather than the nav silently only handling the single-role case because that's what was tested during development.
  • Loading-state flashing needs to be fixed by rendering a stable skeleton/neutral state during AuthContext.loading === true and WalletContext's equivalent initializing state, rather than defaulting to "logged out" appearance and correcting after — this requires auditing the exact initial render output against each context's true initial state.
  • Must verify this across real navigation scenarios: fresh load with a valid persisted token (should never flash logged-out), fresh load with no token (should correctly and immediately show logged-out, no flash of a phantom logged-in skeleton either), and the auth callback redirect flow (/auth/callback → login() → navbar update) transitioning live without a full page reload glitch.

Scope

  • Fully audit Navbar.tsx's conditional rendering against the real state matrix (auth loading/loaded × logged-in/out × wallet connected/not × single/multi-role).
  • Fix any loading-state flash by rendering a proper skeleton/neutral state tied to the real loading flags rather than defaulting to a specific auth state.
  • Implement and document a deliberate UX for the multi-role case.
  • Verify the auth-callback-to-navbar-update transition is glitch-free without a full reload.

Acceptance criteria

  • No flash of incorrect auth/wallet state on any fresh page load with a valid persisted session, verified via slow-network simulation to make the loading window visible.
  • A test user with multiple roles sees a coherent, intentional multi-role nav experience, not just one role's links.

Activity

  1. added
    very hard
    bug
    help wanted
    on Jul 15, 2026
  2. added
    GrantFox OSS
    Maybe Rewarded
    Official Campaign | FWC26
    on Jul 15, 2026
  3. rupesh-kumar-sah commented on Sep 14, 2026

    @rupesh-kumar-sah

    Hello @maintainers,

    I would like to resolve this issue. Here is my proposed execution plan:

    • Implementation: Build Fix Navbar loading-state flashes and multi-role rendering logic with clean React/Next.js components, responsive styling, and proper loading/error boundaries.
    • Testing: Add component unit tests and ensure zero TypeScript/ESLint warnings.

    Happy to pick this up today—please assign to me!

  4. added
    Stellar Wave
    on Sep 26, 2026
  5. Chidubemkingsley commented on Sep 26, 2026

    @Chidubemkingsley
    Contributor

    @Chidubemkingsley has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

    can i work on this

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @Chidubemkingsley to this issue.

  6. Marvellous805 commented on Sep 26, 2026

    @Marvellous805

    @Marvellous805 has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

    Hi maintainer, I can fix this issue and submit quality PR

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @Marvellous805 to this issue.

  7. drips-wave commented on Sep 26, 2026

    @drips-wave

    Congratulations, @Chidubemkingsley! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on September 30, 2026.

    🧑‍💻 @Chidubemkingsley: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

    Warning

    When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

    🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

    🌊 Happy Wave 🌊

  8. grantfox-oss commented on Sep 27, 2026

    @grantfox-oss

    🎉 This issue has been marked as completed on GrantFox!

    @Chidubemkingsley's PR #564 was approved and merged by @chonilius.

    🏆 @Chidubemkingsley: You earned 40 FoxPoints for this contribution! Your current tier: Builder (1,702 total points). Track your full progress on GrantFox.

    👏 Great work, @Chidubemkingsley! Keep contributing to MergeFi.

  9. drips-wave commented on Sep 27, 2026

    @drips-wave

    This issue has been completed by @Chidubemkingsley as part of the Stellar Wave Program's 9th Wave 🥳

    😎 @Chidubemkingsley: You earned 200 Points for completing this issue! After the current Wave ends, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.

    🧑‍💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.

  10. removed
    Stellar Wave
    on Oct 15, 2026
  11. added
    Stellar Wave
    on Oct 15, 2026
  12. removed
    Stellar Wave
    on Oct 15, 2026
  13. added
    Stellar Wave
    on Oct 15, 2026
  14. removed
    Stellar Wave
    on Oct 15, 2026
  15. added
    Stellar Wave
    on Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

GrantFox OSSMaybe RewardedOfficial Campaign | FWC26Stellar Wavebughelp wantedvery hard

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions