diff --git a/core/modules/block/src/BlockListBuilder.php b/core/modules/block/src/BlockListBuilder.php
index 6faa72257d..6996636706 100644
--- a/core/modules/block/src/BlockListBuilder.php
+++ b/core/modules/block/src/BlockListBuilder.php
@@ -379,13 +379,18 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
    * {@inheritdoc}
    */
   public function submitForm(array &$form, FormStateInterface $form_state) {
-    $entities = $this->storage->loadMultiple(array_keys($form_state->getValue('blocks')));
-    /** @var \Drupal\block\BlockInterface[] $entities */
-    foreach ($entities as $entity_id => $entity) {
-      $entity_values = $form_state->getValue(['blocks', $entity_id]);
-      $entity->setWeight($entity_values['weight']);
-      $entity->setRegion($entity_values['region']);
-      $entity->save();
+    $blocks = $form_state->getValue('blocks');
+    // Passing an empty value to ::loadMultiple would load all items from the
+    // storage.
+    if (!empty($blocks)) {
+      $entities = $this->storage->loadMultiple(array_keys($blocks));
+      /** @var \Drupal\block\BlockInterface[] $entities */
+      foreach ($entities as $entity_id => $entity) {
+        $entity_values = $form_state->getValue(['blocks', $entity_id]);
+        $entity->setWeight($entity_values['weight']);
+        $entity->setRegion($entity_values['region']);
+        $entity->save();
+      }
     }
     $this->messenger->addStatus($this->t('The block settings have been updated.'));
   }
diff --git a/core/modules/block/tests/src/Functional/BlockUiTest.php b/core/modules/block/tests/src/Functional/BlockUiTest.php
index 0aa26912e5..352cbb4e99 100644
--- a/core/modules/block/tests/src/Functional/BlockUiTest.php
+++ b/core/modules/block/tests/src/Functional/BlockUiTest.php
@@ -104,6 +104,18 @@ public function testBlockDemoUiPage() {
     \Drupal::service('theme_installer')->install(['stable']);
     $this->drupalGet('admin/structure/block/demo/stable');
     $this->assertSession()->statusCodeEquals(404);
+
+    // Delete all blocks and verify block layout can be saved.
+    $block_storage = \Drupal::service('entity_type.manager')->getStorage('block');
+    $blocks = $block_storage->loadMultiple();
+    foreach ($blocks as $block) {
+      $block->delete();
+    }
+    $this->drupalGet('admin/structure/block');
+    $blocks_table = $this->xpath("//tr[@class='block-enabled']");
+    $this->assertEmpty($blocks_table, 'The blocks table is now empty.');
+    $this->submitForm([], 'Save blocks');
+
   }
 
   /**
