graphitation icon indicating copy to clipboard operation
graphitation copied to clipboard

Duct tape compiler doesn't work with connections and complex connection args

Open sjwilczynski opened this issue 1 year ago • 0 comments

Check PR link for repro: #402

In this case after adding complex argument to connection, if defaultValue is specified for that argument, running yarn duct-tape-compiler in apollo-watch-fragments fails with

➜  apollo-watch-fragments (main) yarn duct-tape-compiler
yarn run v1.22.15
$ duct-tape-compiler --schema ./data/schema.graphql --src ./src --emitQueryDebugComments

Writing ts
DeprecationWarning: 'createTypeAliasDeclaration' has been deprecated since v4.8.0. Decorators are no longer supported for this function. Callers should switch to an overload that does not accept a 'dec
orators' parameter.
DeprecationWarning: 'createImportDeclaration' has been deprecated since v4.8.0. Decorators are no longer supported for this function. Callers should switch to an overload that does not accept a 'decora
tors' parameter.
ERROR:
Error writing modules:
TypeError: value.hasOwnProperty is not a function
    at collectMetadata (C:\Users\stwilczy\Repos\graphitation\node_modules\relay-compiler\lib\util\dedupeJSONStringify.js:48:19)
    at collectMetadata (C:\Users\stwilczy\Repos\graphitation\node_modules\relay-compiler\lib\util\dedupeJSONStringify.js:49:29)
    at collectMetadata (C:\Users\stwilczy\Repos\graphitation\node_modules\relay-compiler\lib\util\dedupeJSONStringify.js:49:29)
    at collectMetadata (C:\Users\stwilczy\Repos\graphitation\node_modules\relay-compiler\lib\util\dedupeJSONStringify.js:49:29)
    at collectMetadata (C:\Users\stwilczy\Repos\graphitation\node_modules\relay-compiler\lib\util\dedupeJSONStringify.js:49:29)
    at dedupeJSONStringify (C:\Users\stwilczy\Repos\graphitation\node_modules\relay-compiler\lib\util\dedupeJSONStringify.js:22:3)
    at printExports (C:\Users\stwilczy\Repos\graphitation\packages\apollo-react-relay-duct-tape-compiler\src\formatModule.ts:152:143)
    at C:\Users\stwilczy\Repos\graphitation\packages\apollo-react-relay-duct-tape-compiler\src\formatModule.ts:118:18
    at C:\Users\stwilczy\Repos\graphitation\node_modules\relay-compiler\lib\codegen\writeRelayGeneratedFile.js:153:22
    at Generator.next (<anonymous>)

Here is where we add the defaultValue:

image

sjwilczynski avatar Feb 13 '24 10:02 sjwilczynski