Remove duplicate records from views feed display for node with multiple grouped terms from one vocabulary I have an RSS feed display in a view, and one of the fields in the view is a multi-value taxonomy reference field. The feed settings have a "Grouping field" setting, and I've chosen that field (and I also have DISTINCT selected in the query settings), but I still get duplicate records. 

When I run the query in MYSQL, I can see that it returns one record per term, so I'm guessing the grouping like that is handled in the display layer that an RSS view doesn't have (even though it does have a grouping setting).

That being said, what is a good place to filter out duplicate results? I saw the Views Distinct module, but it doesn't have a D8 release. In looking at the views hooks, it looks like hook_views_pre_render would be the best place, because at that point the query is run and the $view object has the results.

If anyone has experience with this or a better way, I'm open to suggestions. 

Thanks.
Here's what I came up with that does the job:

/**
 * Implements hook_views_query_pre_render().
 */
function video_export_views_pre_render(Drupal\views\ViewExecutable $view) {
  $unique_nids = $new_results = array();

  // Loop through results and filter out duplicate results.
  foreach($view-&gt;result as $index =&gt; $result) {
    if(!in_array($result-&gt;nid, $unique_nids)) {
      $unique_nids[] = $result-&gt;nid;
    }
    else {
      $new_results[] = $result;
    }
  }
  // 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_results;
}