[ObjectType] attribute generates context.GetGlobalState for [ScopedState] arguments
onionhammer opened this issue · 0 comments
onionhammer commented
Product
Hot Chocolate
Version
14.0.0
Link to minimal reproduction
onionhammer/repro-graphql-mutations@04a5508
Steps to reproduce
When creating a query method on a class which has the [ObjectType] attribute, code is generated that looks like this:
[ObjectType<Lead>]
public static partial class LeadType
{
public static string GetPartnerName([ScopedState("PartnerId")] string id)
{
return $"Partner {id}";
}
}
var args0 = context.GetGlobalState<global::System.Guid>("PartnerId");
Which always fails, since the id is in scoped state, not globalstate
What is expected?
If the ScopedState attribute exists on the argument, the generated code should be invoking "GetScopedState".
What is actually happening?
The generated code is attempting to load scoped state from global state and crashing
Relevant log output
No response
Additional context
No response