Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Same query name causes type provider to use the first one #267
Comments
|
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. |
[WIP] #267 make client type provider treat custom scalars as strings
|
I'm okay with that just adding a design-time error would be extremely helpful! |
|
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. |
|
Can we use the query file name instead of (or in conjunction to) query name as its identifier? |
|
We could, but it still wouldn't solve the problem of inline queries. |
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