feat(plugin-multi-tenant): add tenantSelectorComponent option to cust… #12372
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
tenantSelectorComponent
optionIntroduces a new
tenantSelectorComponent?: CustomComponent | null
field on the multi-tenant plugin config, with three modes:null
→ no selector is renderedundefined
→ the existing default selector is usedWhy?
Developers can now completely disable the selector or swap in a custom implementation.
Examples:
This is useful when willing to customise and workaround the UX problem described in the issue Switching tenant while editing a document unintentionally changes document tenant #12369.
In this issue switching tenants via the selector edits the current document’s tenant field, causing unintentional cross-tenant migrations. A custom tenant selector allowed me and others to customise the logic and redirect to the home page before mutating the tenant field (which avoids the document field unintentional modification).
Some developers just want to opt it out (no needs for the selector) Multi Tenant Plugin | Disable the Tenant Selector Provider + Dropdown #11856
This property is an intuitive addition in the current design and it unlocks customization and workarounds for UI and UX
How?
Schema change
Component setup
Link to issue
Provides a configuration-level workaround for the behavior detailed in [#12369](Switching tenant while editing a document unintentionally changes document tenant #12369) without baking in a specific redirect or mutation strategy.