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

Support for unnamed queries? (Use hash of query text?) #66

Open
benny-medflyt opened this issue Mar 11, 2021 · 3 comments
Open

Support for unnamed queries? (Use hash of query text?) #66

benny-medflyt opened this issue Mar 11, 2021 · 3 comments

Comments

@benny-medflyt
Copy link

Hello, the requirement to name each query is sometimes inconvenient (and for large projects can lead to collisions).

What about the idea of auto-generating a name based on the hash of the query text?

I might be able to submit a pull request for this.

Thank you

@emmatown
Copy link
Member

A PR for an eslint rule (not in the main ESLint rule) that can fix unnamed queries with a random string(random rather than a hash so that it doesn't change when you make a change to the query and there won't be conflicts if there are identical queries) sounds good

@benny-medflyt
Copy link
Author

Thank you. May I ask why not a hash? If two queries happen to be identical then they will have the same hash and then they will use the same generated file. Why would this lead to a conflict?

@emmatown
Copy link
Member

It would lead to a conflict because @ts-gql/compiler disallows multiple queries with the same name

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

No branches or pull requests

2 participants