Skip to content

Switching tenant while editing a document unintentionally changes document tenant #12369

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Lezzio opened this issue May 10, 2025 · 2 comments
Closed
Labels
area: ui Related to the admin panel.

Comments

@Lezzio
Copy link

Lezzio commented May 10, 2025

Describe the Bug.

Issue description:
In the multi-tenant plugin for Payload CMS, when a user is editing a document and switches tenant using the tenant selector in the admin UI, the currently edited document’s tenant is updated to the newly selected tenant. This behavior can (and does) unintentionally move documents between tenants.

Expected behavior:
Instead of updating the tenant on the document being edited, switching tenant should either:

  • Redirect the user to the collection list view of the newly selected tenant, or
  • Redirect the user to the admin home page for the newly selected tenant

This would prevent accidental cross-tenant updates and ensure clearer separation between tenants.

Multi-tenant.bug.mov

Reproduction Steps

  • Enable the multi-tenant plugin on a collection
  • Use the menu's tenant selector to switch from one tenant to another
  • Observe the tenant field being updated (field can be toggled using the multi-tenant debug)

Environment Info

"@payloadcms/plugin-multi-tenant": "3.35.1",
"payload": "3.35.1",
Node.js: 20.9.0
Next.js: 15.2.3
@Lezzio Lezzio added status: needs-triage Possible bug which hasn't been reproduced yet area: ui Related to the admin panel. labels May 10, 2025
@JarrodMFlesch
Copy link
Contributor

This has been addressed in this PR.

@github-actions github-actions bot removed the status: needs-triage Possible bug which hasn't been reproduced yet label May 22, 2025
Copy link
Contributor

This issue has been automatically locked.
Please open a new issue if this issue persists with any additional detail.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: ui Related to the admin panel.
Projects
None yet
Development

No branches or pull requests

2 participants