-
Notifications
You must be signed in to change notification settings - Fork 202
Closed
Labels
Description
The entity_reference_revisions data producer currently returns null if no entites are referenced.
* @return \GraphQL\Deferred|null
* A promise that will return entities or NULL if there aren't any.
My schema currently looks something like this:
type Page implements NodeInterface {
id: Int!
title: String!
content: [ParagraphInterface]
}
Of course, frontend could also handle null but shouldn't we return an empty array here?
if (empty($entities)) {
$type = $this->entityTypeManager->getDefinition($type);
/** @var \Drupal\Core\Entity\EntityTypeInterface $type */
$tags = $type->getListCacheTags();
$context->addCacheTags($tags);
return NULL;
}
edit: I realize the schema actually dictates this and we could always create own data producers, just wondering what about sensible defaults.
joaogarin and arnovdw