diff --git a/core/modules/views_ui/src/ViewPreviewForm.php b/core/modules/views_ui/src/ViewPreviewForm.php
index af97e15..1737d29 100644
--- a/core/modules/views_ui/src/ViewPreviewForm.php
+++ b/core/modules/views_ui/src/ViewPreviewForm.php
@@ -68,7 +68,7 @@ public function form(array $form, FormStateInterface $form_state) {
         '#weight' => 110,
         '#theme_wrappers' => array('container'),
         '#attributes' => array('id' => 'views-live-preview'),
-        '#markup' => $view->renderPreview($this->displayID, $args),
+        'preview' => $view->renderPreview($this->displayID, $args),
       );
     }
     $uri = $view->urlInfo('preview-form');
diff --git a/core/modules/views_ui/src/ViewUI.php b/core/modules/views_ui/src/ViewUI.php
index e8464fa..d959f36 100644
--- a/core/modules/views_ui/src/ViewUI.php
+++ b/core/modules/views_ui/src/ViewUI.php
@@ -577,7 +577,6 @@ public function renderPreview($display_id, $args = array()) {
     $combined = $show_query && $show_stats;
 
     $rows = array('query' => array(), 'statistics' => array());
-    $output = '';
 
     $errors = $this->executable->validate();
     $this->executable->destroy();
@@ -599,7 +598,9 @@ public function renderPreview($display_id, $args = array()) {
       $this->executable->setExposedInput($exposed_input);
 
       if (!$this->executable->setDisplay($display_id)) {
-        return t('Invalid display id @display', array('@display' => $display_id));
+        return [
+          '#markup' => t('Invalid display id @display', array('@display' => $display_id)),
+        ];
       }
 
       $this->executable->setArguments($args);
@@ -644,7 +645,6 @@ public function renderPreview($display_id, $args = array()) {
 
       // Execute/get the view preview.
       $preview = $this->executable->preview($display_id, $args);
-      $preview = drupal_render($preview);
 
       if ($show_additional_queries) {
         $this->endQueryCapture();
@@ -769,10 +769,16 @@ public function renderPreview($display_id, $args = array()) {
     }
 
     if ($show_location === 'above' || $show_stats === 'above') {
-      $output .= drupal_render($table) . $preview;
+      $output = [
+        'table' => $table,
+        'preview' => $preview,
+      ];
     }
     elseif ($show_location === 'below' || $show_stats === 'below') {
-      $output .= $preview . drupal_render($table);
+      $output = [
+        'preview' => $preview,
+        'table' => $table,
+      ];
     }
 
     // Ensure that we just remove an additional request we pushed earlier.
