dotansimha / graphql-code-generator-community

MIT License
118 stars 153 forks source link

Infinite rendering occurs when date or datetime type values are used as arguments. #177

Open mayone-du opened 2 years ago

mayone-du commented 2 years ago

Describe the bug

**To Reproduce** Steps to reproduce the behavior:
  1. My GraphQL schema:
# Put your schema here
type Query {
  test(customArg: String): String
}
  1. My GraphQL operations:
# Put your operations herequery Test($customArg: String!) {
  test(customArg: $customArg)
}
  1. My codegen.yml config file:
# Put your YML here
schema: http://localhost:4000/graphql/
documents: src/graphql/operations/**/*.graphql
generates:
  src/graphql/schemas/generated/schema.ts:
    plugins:
    - typescript
    - typescript-operations
    - typescript-react-apollo
config:
  namingConvention:
    transformUnderscore: true
  scalars:
    BigInt: bigint
    DateTime: string
    EmailAddress: string

Expected behavior

Environment:

Additional context

If you pass dayjs().toISOString() or new Date().toString(), infinite rendering will occur.

With dayjs().toString(), it was not infinite rendering, but it was extra rendering.

I don't know if it's a bug in graphql-code-generator or in GraphQL.js, but I'm sorry if this is the wrong place to post this. Is there anything I can do to help?

charlypoly commented 2 years ago

Hi @mayone-du,

Thank you for your report!

Could you please provide a reproduction on Codesandbox by using our template? ➑️ https://codesandbox.io/s/github/dotansimha/graphql-code-generator-issue-sandbox-template/tree/master/

Thank you!

mayone-du commented 2 years ago

@charlypoly OK, please waitπŸ‘

kokweng911 commented 1 year ago

Do we have any updates on this? it’s still and issue when comparing dates. Eg. createdAt: { gte: dayjs() }