Load role permissions when opening the Edit Role dialog #17
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/edit-role-permissions-loading"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The Edit Role dialog reads from
rolePermissionsForView/roleUsersForView, buteditRole(role)only ever populated the form fields and showed the dialog — those arrays were left at whatever state the rest of the page had set them to. Result: opening Edit Role for a role with existing permissions showed "No permissions assigned to this role yet", and the list only "appeared" because adding a permission triggered a refresh.Mirror
viewRole's pattern: clear both arrays,GET /admin/roles/{id}, populate from the response, then show the dialog after$nextTick. Also reset both arrays incloseRoleDialogso leftover state doesn't survive a close → open-Create round trip (defensive — Create flow doesn't read them today, but keeps the two close handlers symmetrical).Closes #14
Test plan
GET /admin/roles/{id}fails, a negative notification shows and the dialog still opens (so the user can still update name/description).🤖 Generated with Claude Code
The dialog reads from rolePermissionsForView / roleUsersForView, but editRole(role) only ever populated the form fields and showed the dialog — those arrays were left at whatever state the rest of the page had set them to. Result: opening Edit Role for a role with existing permissions showed "No permissions assigned to this role yet", and the list only "appeared" because adding a permission triggered a refresh. Mirror viewRole's pattern: clear both arrays, GET /admin/roles/{id}, populate from the response, then show the dialog after $nextTick. Closes #14