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

RFC: Reduce whitespace in queries by using stripIgnoredCharacters #907

Closed
dhinklexo opened this issue Jul 16, 2020 · 1 comment · Fixed by #908
Closed

RFC: Reduce whitespace in queries by using stripIgnoredCharacters #907

dhinklexo opened this issue Jul 16, 2020 · 1 comment · Fixed by #908
Labels
future 🔮 An enhancement or feature proposal that will be addressed after the next release

Comments

@dhinklexo
Copy link

Summary

Currently when we make graphql requests using GET, the length of the request is much longer than anticipated because whitespace is included in the request itself. From my research, this appears to occur when we transform the AST from graphql-tag into a string via graphql. Aside from being a longer (and therefore slower) request, this also hits max length issues which are most apparent on GET requests.

Proposed Solution

graphql 14.3.0 adds a utility function called stripIgnoredCharacters ( graphql/graphql-js#1802 ) that we can call on the stringified request to remove whitespace characters that don't impact the query itself. We should make use of this utility function.

I'll attach a sample request and the formatted query as a follow up

@dhinklexo dhinklexo added the future 🔮 An enhancement or feature proposal that will be addressed after the next release label Jul 16, 2020
@dhinklexo
Copy link
Author

Here's the repro of the underlying behavior this proposal aims to correct:

https://github.com/dhinklexo/urql-whitespace-issue-test-bench

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
future 🔮 An enhancement or feature proposal that will be addressed after the next release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant