If you have any resolvers waiting for promises using the ->then()
method you need to replace these with the yield
keyword.
Example:
public function topVotedComment(Article $source, $args, $context, $info)
{
return $context['loader'](Closure::fromCallable([$this, 'loadComments']))
->load($source->id)
->then(function ($articleComments) {
return collect($articleComments)->sortByDesc('votes')->first();
});
}
to
public function topVotedComment(Article $source, $args, $context, $info)
{
$comments = yield $context['loader'](Closure::fromCallable([$this, 'loadComments']))
->load($source->id);
return collect($comments)->sortByDesc('votes')->first();
}
If you manually instantiate Butler\Graphql\DataLoader
anywhere you need to update your code. It's no longer necessary to provide a React\EventLoop\LoopInterface
to the constructor.
Example:
$dataLoader = new DataLoader($this->getLoop());
to
$dataLoader = new DataLoader();