litellm/.github
ryan-crabbe-berri 73e9071311
refactor(ui): extract auth state into AuthContext (#28910)
* refactor(ui): extract auth state into AuthContext

Move auth state (token, userID, userRole, accessToken, premiumUser, userEmail,
disabledPersonalKeyCreation, showSSOBanner) out of src/app/page.tsx into a
new AuthProvider at src/contexts/AuthContext.tsx. Wrapped at the root layout
so login/onboarding/dashboard routes all have access via useAuth().

Day 1 foundation for the App Router migration: migrated (dashboard)/X/page.tsx
route entry points won't have a parent passing props, so shared auth state
must live in a context they can read from.

Sub-components are unchanged — they still receive accessToken/userID/userRole
as props from page.tsx (which now reads them from useAuth()). Only the
page.tsx → top-level-page-component handoff is de-drilled; deeper prop
drilling is left for the per-page migration to address.

Net change: -86 lines from page.tsx (state + two effects moved), +5 in
layout.tsx (provider wrap), new AuthContext.tsx (~140 lines), test update
to wrap CreateKeyPage in AuthProvider.

Fixes LIT-3366
Part of LIT-3128

* fix(ui): await getUiConfig before clearing authLoading

The AuthContext refactor flipped authLoading to false synchronously on mount
while letting getUiConfig() run fire-and-forget. On SERVER_ROOT_PATH deployments
this races the unauthenticated login-redirect effect: the redirect fires with
proxyBaseUrl still at its module-init value, sending users to /ui/login instead
of {SERVER_ROOT_PATH}/ui/login.

Restores the original sequencing inside AuthProvider's mount effect and adds a
Playwright spec wired into the existing SERVER_ROOT_PATH workflow matrix. The
spec delays the config endpoint via page.route() to make the race deterministic
across CI runners.
2026-05-26 17:53:03 -07:00
..
codeql [Infra] Improve CodeQL scanning coverage and schedule 2026-03-27 12:04:09 -07:00
ISSUE_TEMPLATE docs: document new github + gitlab ci scripts 2026-03-25 20:17:10 -07:00
observatory Add observatory test workflow for RC/stable releases 2026-03-01 15:30:09 -03:00
screenshots fix(team_endpoints): auto-add SSO team members to org on move (proxy admin only) (#26377) 2026-04-24 08:36:25 -07:00
scripts style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
workflows refactor(ui): extract auth state into AuthContext (#28910) 2026-05-26 17:53:03 -07:00
dependabot.yaml chore: fixes 2026-04-05 01:30:57 -07:00
deploy-to-aws.png Add files via upload 2023-10-25 16:33:53 -07:00
FUNDING.yml Update FUNDING.yml 2023-09-22 09:51:35 -07:00
pull_request_template.md docs: update pull_request_template to add Linear ticket mentioning 2026-04-27 17:31:03 -07:00
template.yaml (chore) cleanup 2024-02-09 09:28:13 -08:00