★ wanayoo — archive 1999 https://github.com/fsprojects/FSharp.Data.GraphQL/issues/267Nouvelle recherche | Portail wanayoo
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

Same query name causes type provider to use the first one #267

Open
xperiandri opened this issue Mar 16, 2020 · 5 comments
Open

Same query name causes type provider to use the first one #267

xperiandri opened this issue Mar 16, 2020 · 5 comments

Comments

@xperiandri
Copy link
Contributor

@xperiandri xperiandri commented Mar 16, 2020

Description

If you declare Different GraphQLProvider instances with the same query name then type provider compiles the first found query to all type provider generated code where query with the same name occurs

Repro steps

https://github.com/ZhenyaP/fsharp-graphql-client-sample

Expected behavior

Even though queries have the same name they are defined in different instances hence must be compiled with each defined query in each instance correspondently.

Actual behavior

Type provider cashes queries by name and then resolve each next query with the same name to the first one cached.

Known workarounds

Use different names for all queries throughout the project.

Related information

  • Package FSharp.Data.GraphQL.Client
  • Version 1.0.3
  • .NET Core App 3.1, .NET Standard 2.0
@johnberzy-bazinga
Copy link
Collaborator

@johnberzy-bazinga johnberzy-bazinga commented Mar 22, 2020

This is really by design. We realize it's a bit of a pitfall. We can mangle the name, but the type name but it would need to be deterministic. Changing the name to add a hash of the query as a suffix means that modifying a query would result in a new type name.

johnberzy-bazinga added a commit that referenced this issue Mar 22, 2020
[WIP] #267 make client type provider treat custom scalars as strings
@xperiandri
Copy link
Contributor Author

@xperiandri xperiandri commented Mar 22, 2020

I'm okay with that just adding a design-time error would be extremely helpful!

@johnberzy-bazinga
Copy link
Collaborator

@johnberzy-bazinga johnberzy-bazinga commented Mar 22, 2020

Yes. I don't know if there is a way to do that unfortunately. We can't differentiate between a query that's been updated (i.e. the same query being modified) vs. a new query with the same name as far as I know.

@xperiandri
Copy link
Contributor Author

@xperiandri xperiandri commented Mar 24, 2020

Can we use the query file name instead of (or in conjunction to) query name as its identifier?

@johnberzy-bazinga
Copy link
Collaborator

@johnberzy-bazinga johnberzy-bazinga commented Mar 24, 2020

We could, but it still wouldn't solve the problem of inline queries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.