How to remove duplicate results from views block?
For anyone else looking for a Drupal 8 solution for Views Distinct, I was able to get this to work by creating a custom module with MY_MODULE.views_execution.inc file with this code:

&lt;?php

use Drupal\views\ViewExecutable;

/**
 * Implements hook_views_pre_render().
 */
function MY_MODULE_views_pre_render(Drupal\views\ViewExecutable $view) {
  $unique_uuids = $new_view_result = [];
  $new_row_index = 0;

  // Loop through results and filter out duplicate results.
  foreach ($view-&gt;result as $row) {
    // Use UUID so this works for all entities
    $uuid = $row-&gt;_entity-&gt;uuid();

    if (!in_array($uuid, $unique_uuids)) {
      $row-&gt;index = $new_row_index;
      $new_view_result[] = $row;
      $unique_uuids[] = $uuid;
      $new_row_index++;
    }
  }

  // Replace $view-&gt;result with new array. Apparently views requires sequentially keyed
  // array of results instead of skipping keys (e.g. 0, 2, 4, etc), so we can't just
  // unset the duplicates.
  $view-&gt;result = $new_view_result;

  // Update the view index to match the new number of rows.
  $view-&gt;total_rows = $new_row_index;
}