Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

Added a null guard for args field

Andrew Bastinedbb81d089b6
diff --git a/components/graphql/field.vue b/components/graphql/field.vue
index 03855565c..144b1dcd5 100644
--- a/components/graphql/field.vue
+++ b/components/graphql/field.vue
@@ -35,7 +35,7 @@ export default {
computed: {
fieldString() {
- const args = this.gqlField.args.reduce((acc, arg, index) => {
+ const args = (this.gqlField.args || []).reduce((acc, arg, index) => {
return acc + `${arg.name}: ${arg.type.toString()}${(index !== this.gqlField.args.length - 1) ? ", " : ''}`;
}, '');
const argsString = (args.length > 0) ? `(${args})` : '';