graphql-extra icon indicating copy to clipboard operation
graphql-extra copied to clipboard

Node "type" raw string: "Maximum call stack exceeded"

Open GavinRay97 opened this issue 4 years ago • 0 comments

If you try to t.objectType or any of it's variants, and then document.createObjectType or document.upsertObjectType() when the type value is a a string (or basically anything but the hack using t.scalarType().name it throws Maximum call stack exceeded from the call to cloneDeep in utils file: `

Demo here: https://repl.it/@GavinRay97/AquamarineGoldFibonacci

const mutation = t.mutationType({
   fields: [
     t.fieldDef({
       name: 'test',
       arguments: [
         t.inputVal({
           name: 'val1',
           type: 'Int',
         }),
       ],
     }),
   ],
 })

image

This works, but nothing else does:

  const mutation = t.mutationType({
    fields: [
      t.fieldDef({
        name: 'test',
        arguments: [
          t.inputVal({
            name: 'val1',
            type: t.scalarType({ name: "Int!" }).name
          }),
        ],
      }),
    ],
  })

GavinRay97 avatar May 07 '20 22:05 GavinRay97