Provide a draft for the edges/nodes removal
This commit is contained in:
parent
92a6e1f10f
commit
17b0047b32
|
|
@ -15,9 +15,32 @@ const httpLink = new HttpLink({
|
||||||
|
|
||||||
const consoleLink = new ApolloLink((operation, forward) => {
|
const consoleLink = new ApolloLink((operation, forward) => {
|
||||||
console.log(`starting request for ${operation.operationName}`);
|
console.log(`starting request for ${operation.operationName}`);
|
||||||
|
|
||||||
|
// This is a proposal for our edges/nodes removal: plz review
|
||||||
|
//
|
||||||
|
// function getRidOfEdges(collection) {
|
||||||
|
// if (typeof collection === 'object') {
|
||||||
|
// let newObj = {}
|
||||||
|
// for (const k in collection) {
|
||||||
|
// if (k === 'edges' || k === 'node') {
|
||||||
|
// newObj = getRidOfEdges(collection[k])
|
||||||
|
// } else {
|
||||||
|
// newObj[k] = getRidOfEdges(collection[k])
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return newObj
|
||||||
|
// } else {
|
||||||
|
// return collection
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
return forward(operation).map((data) => {
|
return forward(operation).map((data) => {
|
||||||
console.log(`ending request for ${operation.operationName}`);
|
console.log(`ending request for ${operation.operationName}`);
|
||||||
return data;
|
|
||||||
|
// debugger
|
||||||
|
// let data = getRidOfEdges(inData)
|
||||||
|
// return resultData;
|
||||||
|
return data
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,31 @@
|
||||||
},
|
},
|
||||||
fetchPolicy: 'network-only',
|
fetchPolicy: 'network-only',
|
||||||
manual: true,
|
manual: true,
|
||||||
result({data, loading}, networkStatus) {
|
result({data, loading, networkStatus}) {
|
||||||
|
|
||||||
|
// This is a proposal for our edges/nodes removal: plz review
|
||||||
|
//
|
||||||
|
function getRidOfEdges(collection) {
|
||||||
|
if (typeof collection === 'object') {
|
||||||
|
let newObj = {}
|
||||||
|
for (const k in collection) {
|
||||||
|
if (k === 'edges' || k === 'node') {
|
||||||
|
newObj = getRidOfEdges(collection[k])
|
||||||
|
} else {
|
||||||
|
newObj[k] = getRidOfEdges(collection[k])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return newObj
|
||||||
|
} else {
|
||||||
|
return collection
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Result of edges/nodes removal
|
||||||
|
//
|
||||||
|
var purgedData = getRidOfEdges(data)
|
||||||
|
// debugger
|
||||||
|
|
||||||
if (!loading) {
|
if (!loading) {
|
||||||
const node = data.modules.edges[0].node;
|
const node = data.modules.edges[0].node;
|
||||||
this.module = {
|
this.module = {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue