Address review feedback: Resolve N+1 issues
<!--IssueSummary start--> <details> <summary> Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards. </summary> - [Work on this issue](https://contributors.gitlab.com/manage-issue?action=work&projectId=278964&issueIid=409567) - [Close this issue](https://contributors.gitlab.com/manage-issue?action=close&projectId=278964&issueIid=409567) </details> <!--IssueSummary end--> MR: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/119434+ Address the following potential N+1 problems with `WorkspaceType` and other areas, which were found during review: - [ ] https://gitlab.com/gitlab-org/gitlab/-/merge_requests/105783#note_1374842474 - _"**Performance:** This will most likely cause an N+1, so we might want to preload it (in the resolver)."_ - https://gitlab.com/gitlab-org/gitlab/-/blob/remote_dev/ee/app/graphql/types/remote_development/workspace_type.rb#L22-22 - ```ruby field :user, ::Types::UserType, null: false, description: 'Owner of the workspace.' ``` - [ ] https://gitlab.com/gitlab-org/gitlab/-/merge_requests/105783#note_1374844224 - _"**Performance**: I'm not 100% sure but this also *might* cause an N+1."_ - https://gitlab.com/gitlab-org/gitlab/-/blob/remote_dev/ee/app/graphql/types/remote_development/workspace_type.rb#L14-14 - ```ruby field :cluster_agent, ::Types::Clusters::AgentType, null: false, method: :agent, description: 'Kubernetes Agent associated with the workspace.' ``` - [ ] https://gitlab.com/gitlab-org/gitlab/-/merge_requests/105783#note_1374939446 - _"**Performance:** We need an N+1 spec in this file"_ - https://gitlab.com/gitlab-org/gitlab/-/blob/remote_dev/ee/spec/requests/api/graphql/remote_development/workspaces_by_ids_spec.rb#L5-5 - ```ruby RSpec.describe 'Query.workspaces(ids: [RemoteDevelopmentWorkspaceID!])', feature_category: :remote_development do ``` ## References - https://docs.gitlab.com/ee/development/api_graphql_styleguide.html#look-ahead
issue