Is there a method/middleware I can call before the response is sent back to the client and after all nested resolvers have been called? #1191
Unanswered
drewgallagher
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to implement a csv export that depends on a queries resolved fields already being available.
The main query returns a subset of records and for reach record, the type resolvers pull the extra data needed to send back to the client.
Because it's challenging to refactor and I need all of the resolved data for building the csv export, I was hoping there was a way to perform an action before the response is sent back to the client and after all resolvers have been called.
ChatGPT suggested using a laravel event after the execution of the GraphQL has completion resolution.
Do you know of any way to implement this?
Currently I am using the
GraphQL::query()method within a job to retrieve the full result of the query, including nested resolver fields. That is working for now, but we have to callAuth::setUser()so we don't get an unauthorized call. It would be nice if there was an event or callback after all resolvers have finished.Beta Was this translation helpful? Give feedback.
All reactions