Skip to content

Investigate unused fields in workItemTreeQuery

The query workItemTreeQuery is very complex due to the amount of metadata that needs to be displayed in the children list, so we should investigate if there are any fields that can be removed.

current children list query
query workItemTreeQuery($id: WorkItemID!, $pageSize: Int = 100, $endCursor: String) {
  workItem(id: $id) {
    namespace {
      id
      fullName
    }
    ...WorkItemHierarchy
  }
}

fragment WorkItemHierarchy on WorkItem {
  id
  workItemType {
    id
    name
    iconName
  }
  title
  confidential
  userPermissions {
    ...WorkItemPermissions
  }
  widgets {
    type
    ... on WorkItemWidgetHierarchy {
      type
      hasChildren
      hasParent
      depthLimitReachedByType {
        workItemType {
          id
          name
        }
        depthLimitReached
      }
      rolledUpCountsByType {
        countsByState {
          opened
          all
          closed
        }
        workItemType {
          id
          name
          iconName
        }
      }
      parent {
        id
      }
      children(first: $pageSize, after: $endCursor) {
        pageInfo {
          ...PageInfo
        }
        count
        nodes {
          id
          iid
          confidential
          workItemType {
            id
            name
            iconName
          }
          namespace {
            id
            fullPath
            name
          }
          title
          state
          createdAt
          closedAt
          webUrl
          reference(full: true)
          widgets {
            ... on WorkItemWidgetHierarchy {
              type
              hasChildren
              rolledUpCountsByType {
                countsByState {
                  all
                  closed
                }
                workItemType {
                  id
                  name
                  iconName
                }
              }
            }
            ...WorkItemMetadataWidgets
          }
        }
      }
    }
    ...WorkItemMetadataWidgets
  }
}

fragment PageInfo on PageInfo {
  hasNextPage
  hasPreviousPage
  startCursor
  endCursor
}

fragment WorkItemPermissions on WorkItemPermissions {
  adminParentLink
  adminWorkItemLink
  createNote
  deleteWorkItem
  markNoteAsInternal
  moveWorkItem
  reportSpam
  setWorkItemMetadata
  summarizeComments
  updateWorkItem
  blockedWorkItems
}

fragment WorkItemMetadataWidgets on WorkItemWidget {
  type
  ... on WorkItemWidgetStartAndDueDate {
    dueDate
    startDate
  }
  ... on WorkItemWidgetWeight {
    weight
    rolledUpWeight
    widgetDefinition {
      editable
      rollUp
      __typename
    }
  }
  ... on WorkItemWidgetProgress {
    progress
    updatedAt
  }
  ... on WorkItemWidgetHealthStatus {
    healthStatus
    rolledUpHealthStatus {
      count
      healthStatus
    }
  }
  ... on WorkItemWidgetMilestone {
    milestone {
      ...MilestoneFragment
    }
  }
  ... on WorkItemWidgetAssignees {
    allowsMultipleAssignees
    canInviteMembers
    assignees {
      nodes {
        ...User
      }
    }
  }
  ... on WorkItemWidgetLabels {
    allowsScopedLabels
    labels {
      nodes {
        ...Label
      }
    }
  }
  ... on WorkItemWidgetLinkedItems {
    blockedByCount
    blockingCount
  }
  ... on WorkItemWidgetIteration {
    iteration {
      id
      title
      startDate
      dueDate
      webUrl
      iterationCadence {
        id
        title
      }
    }
  }
  ... on WorkItemWidgetStatus {
    status {
      ...WorkItemStatusFragment
    }
  }
}

fragment Label on Label {
  id
  title
  description
  color
  textColor
}

fragment User on User {
  id
  avatarUrl
  name
  username
  webUrl
  webPath
}

fragment MilestoneFragment on Milestone {
  expired
  id
  title
  state
  startDate
  dueDate
  webPath
  projectMilestone
}

fragment WorkItemStatusFragment on WorkItemStatus {
  id
  name
  description
  iconName
  color
  position
}
variables
{
  "pageSize": 50,
  "id": "gid://gitlab/WorkItem/160616277",
  "endCursor": ""
}

Relevant discussion: !198531 (comment 2682915724)

Edited by 🤖 GitLab Bot 🤖