Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for GQL document input #1151

Merged
merged 7 commits into from
Jan 19, 2024
Merged

Conversation

luke88jones
Copy link
Contributor

@luke88jones luke88jones commented Jan 16, 2024

What does this PR do?

  • add support for supplying your query in the DocumentNode format
  • add support for Typescript response typing via the TypedDocumentNode inference

Related issues

Resolves #1128

Checklist

  • I have checked the contributing document
  • I have added or updated any relevant documentation
  • I have added or updated any relevant tests

@simoneb
Copy link
Member

simoneb commented Jan 16, 2024

CI is broken

@simoneb simoneb changed the title draft: feat: add support for GQL document input feat: add support for GQL document input Jan 16, 2024
@simoneb simoneb marked this pull request as draft January 16, 2024 17:22
@luke88jones luke88jones marked this pull request as ready for review January 17, 2024 08:56
Copy link
Member

@simoneb simoneb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job so far, a few comments inline

README.md Show resolved Hide resolved
examples/typescript/src/App.tsx Outdated Show resolved Hide resolved
)
}
const queryString = stringifyDocumentNode(query)
const operationName = extractOperationName(query) ?? initialOpts.operationName
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this logic correct? if you provide an operation name explicitly, shouldn't it have more priority than the one we infer from the query? unless I'm reading this wrong

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected this.

packages/graphql-hooks/src/utils.ts Show resolved Hide resolved
@simoneb simoneb merged commit 02261fe into master Jan 19, 2024
5 checks passed
@simoneb simoneb deleted the document-node-support branch January 19, 2024 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support TypedDocumentNode
2 participants