Commit 12c8c435 authored by Kushal Pandya's avatar Kushal Pandya

Use fragments in query and include `__typename`

Separate query and fragments in separate files.
Revert back to including `__typename` in response.
parent bb88a1ae
query childItems($fullPath: ID!, $iid: ID) {
group(fullPath: $fullPath) {
id
path
fullPath
epic(iid: $iid) {
id
iid
title
webPath
userPermissions {
adminEpic
createEpic
}
children {
edges {
node {
id
iid
title
state
webPath
reference(full: true)
relationPath
createdAt
closedAt
hasChildren
hasIssues
userPermissions {
adminEpic
createEpic
}
group {
fullPath
}
}
}
}
issues {
edges {
node {
iid
title
closedAt
state
createdAt
confidential
dueDate
weight
webPath
reference
relationPath
assignees {
edges {
node {
webUrl
name
username
avatarUrl
}
}
}
milestone {
title
startDate
dueDate
}
}
}
}
}
}
}
fragment BaseEpic on Epic {
id
iid
title
webPath
userPermissions {
adminEpic
createEpic
}
}
fragment EpicNode on Epic {
...BaseEpic
state
reference(full: true)
relationPath
createdAt
closedAt
hasChildren
hasIssues
group {
fullPath
}
}
#import "./epic.fragment.graphql"
#import "./issue.fragment.graphql"
query childItems($fullPath: ID!, $iid: ID) {
group(fullPath: $fullPath) {
id
path
fullPath
epic(iid: $iid) {
...BaseEpic
children {
edges {
node {
...EpicNode
}
}
}
issues {
edges {
node {
...IssueNode
}
}
}
}
}
}
fragment IssueNode on EpicIssue {
iid
title
closedAt
state
createdAt
confidential
dueDate
weight
webPath
reference
relationPath
assignees {
edges {
node {
webUrl
name
username
avatarUrl
}
}
}
milestone {
title
startDate
dueDate
}
}
......@@ -14,7 +14,7 @@ import {
import { processQueryResponse, formatChildItem, gqClient } from '../utils/epic_utils';
import { ActionType, ChildType, ChildState } from '../constants';
import childItems from '../queries/child_items.graphql';
import epicChildren from '../queries/epicChildren.query.graphql';
import * as types from './mutation_types';
......@@ -74,7 +74,7 @@ export const fetchItems = ({ dispatch }, { parentItem, isSubItem = false }) => {
gqClient
.query({
query: childItems,
query: epicChildren,
variables: { iid: parentItem.iid, fullPath: parentItem.fullPath },
})
.then(({ data }) => {
......
......@@ -2,14 +2,7 @@ import createGqClient from '~/lib/graphql';
import { ChildType, PathIdSeparator } from '../constants';
export const gqClient = createGqClient(
{},
{
cacheConfig: {
addTypename: false,
},
},
);
export const gqClient = createGqClient();
/**
* Returns formatted child item to include additional
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment