Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
fix(plugin-multi-tenant): tenant selector not appearing after login (#15617)
When a custom provider in `admin.components.providers` changes its wrapper component type on login (e.g. `<Context.Provider>` → `<Fragment>`), React remounts `TenantSelectionProviderClient`. On remount, `useState(initialTenantOptions)` gets stale props and `useRef(userID)` re-initializes so `syncTenants()` never fires, leaving the tenant selector empty. This only affects projects with a custom provider that conditionally changes its tree structure based on auth state - default setups are unaffected since no built-in provider does this. The fix adds a `useEffect` that syncs `initialTenantOptions` from the server component into client state whenever the prop changes, making it resilient to remounts. Also fixes `test/dev.ts` not forwarding config overrides to import map generation.
A
Alessio Gravili committed
dd09f6797b5841f297e29df9930555db66305a2f
Parent: d57bc22
Committed by GitHub <noreply@github.com>
on 2/13/2026, 5:17:34 PM