Skip to content

Admin status not reflected in UI except on /admin page #11

@ramxcodes

Description

@ramxcodes

Bug Description

The admin status is not working correctly in the UI (NavBar). The adminStatus function should determine admin status, cache it for 30 minutes, and conditionally render an Admin panel button. This works in the local development environment, but fails in production.

Observations:

  • On local dev, the admin panel button appears as expected based on admin status.
  • In production, the admin panel button does not show on any page unless you manually navigate to the /admin page, which then displays the button in the nav.
  • On pages like home or any page that doesn't explicitly check the admin status, the button doesn't render even if you are admin.

Relevant Files:

  • src/components/core/MainNav.tsx
  • src/lib/db/user.ts

Steps to Reproduce

  1. Log in as an admin user in production.
  2. Visit the home page or any non-admin-checking page.
  3. Observe that the Admin panel button does not appear.
  4. Manually go to /admin page. The button appears in the nav.

Expected Behavior

  • The Admin panel button should render across the application if the user is admin, not just on the /admin page.
  • The adminStatus function should cache the result for 30 minutes and be used consistently.

Additional Information

  • Works in local development, fails in production.
  • Possibly related to caching, state management, or rendering logic.

Labels: bug

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions