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

Example/documentation for client.iterate are incorrect? #576

Open
ddebrunner opened this issue Aug 14, 2024 · 1 comment
Open

Example/documentation for client.iterate are incorrect? #576

ddebrunner opened this issue Aug 14, 2024 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@ddebrunner
Copy link

The example client iterator code is here:

https://github.com/enisdenjo/graphql-ws/blob/master/website/src/pages/get-started.mdx?plain=1#L195-L196

and reads as though the value returned from query.next() is the data element of the GraphQL response.

But using the client query.next() with a GraphQL server returns a higher level object:

{"value":{"data":{"user":{"id":"100","name":"Pascale","email":"[email protected]"}}},"done":false}

The tests added by #486 also show that the value returned is the higher-level object:
https://github.com/enisdenjo/graphql-ws/blob/master/src/__tests__/client.ts#L2355-L2361

Maybe I'm missing something, I'm not a javascript/typescript expert so maybe there's some magic going on with the test harness and expect, but I found the mismatch confusing with what value was expected to be returned.

@enisdenjo
Copy link
Owner

Ah you're right! There should be data. You interested in making a PR? 😄

@enisdenjo enisdenjo added the documentation Improvements or additions to documentation label Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants