[FE] Improve create custom role feature
On the Roles and Permissions page, there is a create new role form:
![]() |
We should make the following improvements:
-
refreshQueries
is used to refresh the member roles list from the create form. We should let the parent component (the member list component) handle this instead. -
Backend expects an enum for the access level, i.e.
GUEST
,REPORTER
, etc. Frontend takes the display name, i.e.Guest
,Reporter
, and uppercases it. This is brittle and doesn't work when the string is localized to another language. We should explicitly map the enums from the access level ID. -
When the create mutation is running, the
Create new role
button is disabled, but theCancel
button is not. We should display the cancel button as well. -
The Apollo query can be simplified. In particular, the
then()
can be replaced with anawait()
, and we should not useupdate()
unless we're doing optimistic updates (which we're currently not). -
We should always show the error message from the backend/exception rather than just showing the generic error message. This will help us for debugging and bug reports.