Replies: 1 comment 4 replies
-
Regarding Complexity is handled by the underlying GraphQL library To add stuff to |
Beta Was this translation helpful? Give feedback.
-
Regarding Complexity is handled by the underlying GraphQL library To add stuff to |
Beta Was this translation helpful? Give feedback.
-
I want to add stats to certain results: the duration the query took and the calculated complexity.
Assumed: best to be done using field middleware?
E.g.:
type Query { posts: [Post!]! @paginate(defaultCount: 10) @stats }
Complexity is enabled in lighthouse.php config: e.g.
'max_query_complexity' => 1000
.What I tried:
php artisan lighthouse:directive --field stats
and selectedFieldMiddleware
.This created the stub:
BTW I believe that should be without $next?
(interface says:
public function handleField(FieldValue $fieldValue): void;
)Based on the documentation I added:
How to retrieve the calculated complexity, and how to add the duration and complexity to the result?
Beta Was this translation helpful? Give feedback.
All reactions