-
Versions:
Description:I somehow did not catch this in my testing. Not sure this is webonyx or the latest changes here. Previous releases, types were instanciated each time a new query were sent. Steps To Reproduce:I am instanciating a buffer in a type. And using that. If I am batching two queries that use the same type or just running tests where am quering the same query multiple times in a row. This Buffer will only be instanciated once. Am I doing the instanciating wrong, are you doing it differently? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 8 replies
-
should have labeled as a question |
Beta Was this translation helpful? Give feedback.
-
I yet have to analyze the current behaviour or change of behaviour etc. But from my POV, nothing non-GraphQL related should be instantiated in If you need access to this stuff in a resolver, the way to go would be to use the context which is essentially "a bag of things" which are passed around and you mutate as you want (dangerously like a "global"). That said: I'm now curious what your actual use case here is 😄 |
Beta Was this translation helpful? Give feedback.
-
I would have to initialize every buffer in middleware or try to dig into the query response and see if there is type that needs a buffer or how are you doing it? |
Beta Was this translation helpful? Give feedback.
I yet have to analyze the current behaviour or change of behaviour etc.
But from my POV, nothing non-GraphQL related should be instantiated in
fields
orargs
, etc. My argument would be: these methods are a fancy way to describe a DSL and usually you don't run application instantiation related code there.If you need access to this stuff in a resolver, the way to go would be to use the context which is essentially "a bag of things" which are passed around and you mutate as you want (dangerously like a "global").
That said: I'm now curious what your actual use case here is 😄