I need your help...
I'm getting the first result with Graphql, but when I call the refresh, returns an undefined
These are the issues in console:
ldsAdaptersUiapiGraphql.js:1 Unknown Field: [object Object]. This field or nested fields cannot participate in normalizationldsAdaptersUiapiGraphql.js:1
Unknown Field: Asset. This field or nested fields cannot participate in normalization
This is my code:
graphqlQueryResult(result) {
this.totalAssets = 0;
this.shreddedAssets = 0;
this.errors = undefined;
const {
data,
errors
} = result;
console.log('IN WIRE');
if (data) {
console.log(JSON.stringify('data ::' + JSON.stringify(data))) this.results = data.uiapi.aggregate.Asset.edges.map((edge) => edge.node);
this.totalAssets = data.uiapi.aggregate.Asset.totalCount;
try {
this.results.forEach(item => {
console.log(item);
console.log(JSON.stringify(item));
if (item.aggregate.Status.value === 'Shredded') {
this.shreddedAssets = item.aggregate.Id.count.value;
}
});
} catch (e) {}
}
this.errors = errors;
this.graphqlData = result; // Store the result so refreshGraphql() can refresh it later
}
get assetQuery() { // Send a request to the server only if recordId is provided.
if (!this.recordId) return undefined;
return gql(ASSET_QUERY);
}
get variables() {
return {
bin: this.recordId
};
}
async refreshAssetCount() {
await refreshGraphQL(this.graphqlData);
}