fix(dashboard): fetch all assignable policies to prevent dropping revocations - #16737
fix(dashboard): fetch all assignable policies to prevent dropping revocations#16737arnav-1124 wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: 8619f3f The changes in this PR will be included in the next version bump. This PR includes changesets to release 83 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Thanks for the contribution! A few items need to be addressed before this can move forward: The PR fixes a real bug in the role-permissions edit form: useRbacAssignablePolicies was called without pagination parameters (defaulting to limit 20), so any assignable policies beyond the first 20 were absent from assignableIds and silently excluded from revocation calculations on submit. The fix adds { limit: 9999, fields: "id" } to ensure the full set of assignable IDs is available for the diff — the approach is sound and the scope is minimal. One blocking issue: the changeset file marks the @medusajs/dashboard package as a major bump, but this is a bug fix that does not remove any exports, change any public API signature, or alter documented behaviour. The bump type must be patch per the contribution guidelines. Non-blocking note: the 9999 cap is pragmatic and reasonable given typical RBAC policy counts, but it is a soft ceiling — an installation with more than 9,999 assignable policies would silently reproduce the bug. The existing code comment already documents the intent; no code change is required for this observation.
Triggered by: new PR opened |
What
Fetches all assignable policies by specifying
{ limit: 9999, fields: "id" }inuseRbacAssignablePolicieswhen computing policy diffs during role permission editing.Why
Fixes #16734. Previously,
useRbacAssignablePolicieswas called without pagination parameters, defaulting tolimit: 20. Any existing policies beyond the first 20 were omitted fromassignableIdsand silently ignored when calculating policy revocations on submit.How
{ limit: 9999, fields: "id" }touseRbacAssignablePoliciesinedit-role-permissions-form.tsx.Testing
assignableIdscontains the full list of policy IDs for diff calculations without truncation.