diff --git a/core/modules/block/src/BlockViewBuilder.php b/core/modules/block/src/BlockViewBuilder.php
index 3b20d7b..0dc4ee8 100644
--- a/core/modules/block/src/BlockViewBuilder.php
+++ b/core/modules/block/src/BlockViewBuilder.php
@@ -235,16 +235,18 @@ public static function preRender($build) {
         '#markup' => '',
         '#cache' => $build['#cache'],
       ];
-      // If $content is not empty, then it contains cacheability metadata, and
-      // we must merge it with the existing cacheability metadata. This allows
-      // blocks to be empty, yet still bubble cacheability metadata, to indicate
-      // why they are empty.
-      if (!empty($content)) {
-        CacheableMetadata::createFromRenderArray($build)
-          ->merge(CacheableMetadata::createFromRenderArray($content))
-          ->applyTo($build);
-      }
     }
+
+    // If $content is not empty, then it contains cacheability metadata, and
+    // we must merge it with the existing cacheability metadata. This allows
+    // blocks to be empty, yet still bubble cacheability metadata, to indicate
+    // why they are empty.
+    if (!empty($content)) {
+      CacheableMetadata::createFromRenderArray($build)
+        ->merge(CacheableMetadata::createFromRenderArray($content))
+        ->applyTo($build);
+    }
+
     return $build;
   }
 
