Fetch custom roles only after invite member modal is opened
What does this MR do and why?
On the group members page, clicking on Invite members
will open the invite members modal:
Group members page | Invite members modal |
---|---|
A GraphQL query is run to get the custom roles for the group, so that they can be added to the Select a role
dropdown. However, there's 2 issues:
-
The query is run when the modal is initialized, not when it's shown.
-
The modal is initialized on every group page.
The two issues combined together means that the GraphQL query is run on every group page, even when the modal is not visible or accessible in the first place:
This MR fixes the first issue so that the query runs only when the modal is visible, preventing it from running on every page. The second issue is much more complex to fix, and is not addressed in this MR.
How to set up and validate locally
- Go to a group ->
Manage
->Members
. - Verify that the
getProjectMemberRoles
query is not run on page load. - Click on
Invite members
. - Verify that the query is run.
- Go to any other group page. Verify that the query is not run.
Related to #436437 (closed)