@@ -43,7 +43,7 @@ public function resolve(object|null $source, array $args, mixed $context, Resolv
4343 }
4444
4545 $ prefetchBuffer = $ context ->getPrefetchBuffer ($ this );
46- $ prefetchBuffer ->register ($ source , $ args );
46+ $ prefetchBuffer ->register ($ source , $ args, $ info );
4747
4848 // The way this works is simple: GraphQL first iterates over every requested field and calls ->resolve()
4949 // on it. That, in turn, calls this method. GraphQL doesn't need the actual value just yet; it simply
@@ -53,20 +53,20 @@ public function resolve(object|null $source, array $args, mixed $context, Resolv
5353 // needed, GraphQL calls the callback of Deferred below. That's when we call the prefetch method,
5454 // already knowing all the requested fields (source-arguments combinations).
5555 return new Deferred (function () use ($ info , $ context , $ args , $ prefetchBuffer ) {
56- if (! $ prefetchBuffer ->hasResult ($ args )) {
56+ if (! $ prefetchBuffer ->hasResult ($ args, $ info )) {
5757 $ prefetchResult = $ this ->computePrefetch ($ args , $ context , $ info , $ prefetchBuffer );
5858
59- $ prefetchBuffer ->storeResult ($ prefetchResult , $ args );
59+ $ prefetchBuffer ->storeResult ($ prefetchResult , $ args, $ info );
6060 }
6161
62- return $ prefetchResult ?? $ prefetchBuffer ->getResult ($ args );
62+ return $ prefetchResult ?? $ prefetchBuffer ->getResult ($ args, $ info );
6363 });
6464 }
6565
6666 /** @param array<string, mixed> $args */
6767 private function computePrefetch (array $ args , mixed $ context , ResolveInfo $ info , PrefetchBuffer $ prefetchBuffer ): mixed
6868 {
69- $ sources = $ prefetchBuffer ->getObjectsByArguments ($ args );
69+ $ sources = $ prefetchBuffer ->getObjectsByArguments ($ args, $ info );
7070 $ toPassPrefetchArgs = QueryField::paramsToArguments ($ this ->fieldName , $ this ->parameters , null , $ args , $ context , $ info , $ this ->resolver );
7171
7272 return ($ this ->resolver )($ sources , ...$ toPassPrefetchArgs );
0 commit comments