Skip to content

Replace fetching work item design with `DesignAtVersion`

Currently, we're fetching a single design on work item with the following query:

query getDesignDetails(
  $fullPath: ID!
  $iid: String!
  $atVersion: DesignManagementVersionID
  $filenames: [String!]
) {
  project(fullPath: $fullPath) {
    id
    workItems(iid: $iid) {
      nodes {
        id
        title
        widgets {
          ... on WorkItemWidgetDesigns {
            type
            designCollection {
              designs(atVersion: $atVersion, filenames: $filenames) {
                nodes {
                  ...DesignFile
                  discussions {
                    nodes {
                      id
                      replyId
                      ...ResolvedStatus
                      notes {
                        nodes {
                          ...DesignNote
                        }
                      }
                    }
                  }
                  issue {
                    id
                    title
                    webPath
                    webUrl
                    participants {
                      nodes {
                        ...Author
                      }
                    }
                    userPermissions {
                      createDesign
                      updateDesign
                    }
                  }
                }
              }
              versions {
                nodes {
                  ...VersionListItem
                }
              }
            }
          }
        }
      }
    }
  }
}

We're also storing it locally to prevent overwriting design management WI widget.

Instead, we could use a global designManagement query:

query {
  designManagement($id: DesignAtVersionId) {
    designAtVersion(id: $id) {
       ...DesignFile
       discussions {...}
       issue {...}
    }
  }
}