diff --git a/core/lib/Drupal/Core/Entity/EntityStorageBase.php b/core/lib/Drupal/Core/Entity/EntityStorageBase.php
index 3d9a90f7620032ae015cbfa9e61fb1f7c13fff88..6d9d2b3256e7c0cb2651e49196d86f568128c8a6 100644
--- a/core/lib/Drupal/Core/Entity/EntityStorageBase.php
+++ b/core/lib/Drupal/Core/Entity/EntityStorageBase.php
@@ -89,6 +89,11 @@ abstract class EntityStorageBase extends EntityHandlerBase implements EntityStor
    */
   protected $memoryCacheTag;
 
+  /**
+   * Entity IDs awaiting loading.
+   */
+  protected array $entityIdsToLoad = [];
+
   /**
    * Constructs an EntityStorageBase instance.
    *
@@ -285,6 +290,21 @@ public function loadMultiple(?array $ids = NULL) {
       $ids = array_keys(array_diff_key($flipped_ids, $entities));
     }
 
+    if ($ids) {
+      $this->entityIdsToLoad += $ids;
+      $fiber = \Fiber::getCurrent();
+      if ($fiber !== NULL) {
+        $fiber->suspend();
+      }
+      $entities += $this->getFromStaticCache($this->entityIdsToLoad);
+      // Replace the IDs to load with the full list of entity IDs to load
+      // collected from previous calls to this method up to this point.
+      if ($entities)  {
+        $ids = array_keys(array_diff_key(array_flip($this->entityIdsToLoad), $entities));
+      }
+      $this->entityIdsToLoad = [];
+    }
+
     // Try to gather any remaining entities from a 'preload' method. This method
     // can invoke a hook to be used by modules that need, for example, to swap
     // the default revision of an entity with a different one. Even though the
diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceFormatterBase.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceFormatterBase.php
index 5e91daf6e494bef85a544bdfdeddb46f9bf9b2c0..70505d0a65057b756c2fbb32b7bf2a60727a2206 100644
--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceFormatterBase.php
+++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceFormatterBase.php
@@ -145,7 +145,6 @@ public function prepareView(array $entities_items) {
       $target_type = $this->getFieldSetting('target_type');
       $target_entities = \Drupal::entityTypeManager()->getStorage($target_type)->loadMultiple($ids);
     }
-
     // For each item, pre-populate the loaded entity in $item->entity, and set
     // the 'loaded' flag.
     foreach ($entities_items as $items) {