You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(plugin-multi-tenant): hasMany tenant fields double-wrap arrays in filterOptions (#15709)
### What
Fixes double-wrapped arrays in filterOptions queries when tenant field
has `hasMany: true`
### Why
When a collection uses `hasMany: true` on the tenant field, documents
store tenant IDs as arrays (e.g., `tenant: [id1, id2]`).
The `filterDocumentsByTenants` function was always wrapping the tenant
value in an array without checking configuration, causing `{ tenant: {
in: [[id1, id2]] } }` instead of `{ tenant: { in: [id1, id2] } }`.
This breaks relationship field filtering in the admin UI.
### How
Added explicit `hasMany` parameter threaded through
`addFilterOptionsToFields` → `addRelationshipFilter` →
`filterDocumentsByTenants`.
When `hasMany` is true and `docTenantID` is provided, the value is used
directly (already an array). Otherwise, it's wrapped in an array.
Fixes#15690
0 commit comments