Skip to content

Add hasChildren field to work items hierarchy widget

Related to #383538 (closed)

What does this MR do and why?

Adds a new field to work items hierarchy widgets that indicates if the work item has children.

Example query:

query {
  workItem(id: "gid://gitlab/Issue/113355760") {
    widgets {
      ... on WorkItemWidgetHierarchy {
        hasChildren
      }
    }
  }
}
example response
{
  "data": {
    "workItem": {
      "widgets": [
        {},
        {},
        {},
        {},
        {},
        {
          "hasChildren": true
        },
        {},
        {},
        {}
      ]
    }
  }
}

This new field uses BatchLoader::GraphQL to batch results for multiple work items with the following query:

SELECT "work_item_parent_links"."work_item_parent_id"
FROM   "work_item_parent_links" 
WHERE  "work_item_parent_links"."work_item_parent_id" IN (115219866, 113355760) 
GROUP  BY "work_item_parent_links"."work_item_parent_id" 

Query plan (internal): https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/13644/commands/47894

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Eugenia Grieff

Merge request reports

Loading