diff --git a/src/Plugin/views/EntityFieldRenderer.php b/src/Plugin/views/EntityFieldRenderer.php
index b47eb95..bdfc700 100644
--- a/src/Plugin/views/EntityFieldRenderer.php
+++ b/src/Plugin/views/EntityFieldRenderer.php
@@ -60,12 +60,11 @@ public function setDatasourceId($datasource_id) {
    * @see EntityFieldRenderer::getRenderableFieldIds()
    */
   public function compatibleWithField(FieldHandlerInterface $field) {
-    if ($field instanceof SearchApiEntityField && $field->relationship == $this->relationship) {
-      // If there is no relationship set, we also need to compare the
-      // datasource ID.
-      if ($field->relationship || $field->getDatasourceId() == $this->datasourceId) {
-        return TRUE;
-      }
+    if ($field instanceof SearchApiEntityField
+        && $field->options['field_rendering']
+        && !empty($field->definition['entity_type'])
+        && $field->definition['entity_type'] === $this->getEntityTypeId()) {
+      return TRUE;
     }
 
     return FALSE;
diff --git a/tests/src/Functional/ViewsTest.php b/tests/src/Functional/ViewsTest.php
index 25276db..8b4a943 100644
--- a/tests/src/Functional/ViewsTest.php
+++ b/tests/src/Functional/ViewsTest.php
@@ -370,6 +370,19 @@ protected function checkResults(array $query, array $expected_results = NULL, $l
    * Test Views admin UI and field handlers.
    */
   public function testViewsAdmin() {
+    // Add a field from a related entity to the index to test whether it gets
+    // displayed correctly.
+    $index = Index::load($this->indexId);
+    $field = \Drupal::getContainer()
+      ->get('search_api.fields_helper')
+      ->createField($index, 'author', [
+        'label' => 'Author name',
+        'type' => 'string',
+        'datasource_id' => 'entity:entity_test_mulrev_changed',
+        'property_path' => 'user_id:entity:name',
+      ]);
+    $index->addField($field)->save();
+
     // Add some Dutch nodes.
     foreach ([1, 2, 3, 4, 5] as $id) {
       $entity = EntityTestMulRevChanged::load($id);
@@ -453,7 +466,7 @@ public function testViewsAdmin() {
       'search_api_index_database_search_index.category',
       'search_api_index_database_search_index.keywords',
       'search_api_datasource_database_search_index_entity_entity_test_mulrev_changed.user_id',
-      'search_api_entity_user.name',
+      'search_api_index_database_search_index.author',
       'search_api_entity_user.roles',
     ];
     $edit = [];
@@ -545,6 +558,11 @@ public function testViewsAdmin() {
           else {
             $data = ['entity:entity_test_mulrev_changed'];
           }
+          // Special case for field "author", which has property path ending in
+          // "name".
+          if ($field === 'name') {
+            $field = 'author';
+          }
           $row_num = 2 * $id + $i - 1;
           $prefix = "#$row_num [$field] ";
           $text = $prefix . implode("|$prefix", $data);
@@ -636,7 +654,7 @@ protected function submitFieldsForm() {
         $edit['options[fallback_options][display_methods][user][display_method]'] = 'id';
         break;
 
-      case 'name':
+      case 'author':
         break;
 
       case 'roles':
