Repository navigation
Opt-in URL based tenant selection for @payloadcms/plugin-multi-tenant #17600
KevinSkayro
started this conversation in
Feature Requests & Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Today @payloadcms/plugin-multi-tenant determines the "currently selected tenant" purely from a payload-tenant cookie. Because a cookie is shared across every tab on the same origin, switching tenants in one browser tab will change what every other open tab resolves to on its next navigation, so there's no real way to have two tabs, each pinned to a different tenant and behave independently. It's also not bookmarkable or shareable: a link to /admin/collections/posts doesn't tell you or who you share it with what tenant you are on.
Proposal
An opt-in mode where the selected tenant context comes from a URL path segment, e.g. /admin/acme/collections/posts. Default (cookie-based) behavior is unchanged unless explicitly enabled, this would be an optional opt in
Admin views would re-render per navigation off the request's own URL, sourcing the tenant from the path (instead of a shared cookie).
Plugins can't currently get an admin route-segment parsing before packages/ui's renderRoot resolves isCollectionRoute/isGlobalRoute. So this needs a small, generic extension point on admin config to let a plugin claim/strip a leading segment and resolve it once a request exists.
Let me know what you think!
All reactions