diff --git a/panels_ipe/src/TempStoreTrait.php b/panels_ipe/src/TempStoreTrait.php
index f64b7a8..ccc3f3a 100644
--- a/panels_ipe/src/TempStoreTrait.php
+++ b/panels_ipe/src/TempStoreTrait.php
@@ -27,25 +27,31 @@ trait TempStoreTrait {
    */
   protected function getTempStoreId(PanelsDisplayVariant $panels_display) {
     $id = $panels_display->id();
-
-    // Get the module handler. We cannot define a $moduleHandler property in
-    // this trait, or we could get fatal errors if classes that use this trait
-    // have a $moduleHandler property of their own.
-    if (isset($this->moduleHandler) && $this->moduleHandler instanceof ModuleHandlerInterface) {
-      $module_handler = $this->moduleHandler;
-    }
-    else {
-      $module_handler = \Drupal::moduleHandler();
+    $modified_id = &drupal_static('panels_ipe_temp_store_id_' . $id);
+
+    if (!$modified_id) {
+      // Get the module handler. We cannot define a $moduleHandler property in
+      // this trait, or we could get fatal errors if classes that use this trait
+      // have a $moduleHandler property of their own.
+      if (isset($this->moduleHandler) && $this->moduleHandler instanceof ModuleHandlerInterface) {
+        $module_handler = $this->moduleHandler;
+      }
+      else {
+        $module_handler = \Drupal::moduleHandler();
+      }
+
+      // Allow modules to alter the tempstore ID.
+      $module_handler
+        ->alter('panels_ipe_tempstore_id', $id, $panels_display);
+
+      $modified_id = $id;
     }
 
-    // Allow modules to alter the tempstore ID.
-    $module_handler
-      ->alter('panels_ipe_tempstore_id', $id, $panels_display);
-
-    if (empty($id)) {
+    if (empty($modified_id)) {
       throw new \UnexpectedValueException('Tempstore ID cannot be empty');
     }
-    return $id;
+
+    return $modified_id;
   }
 
 }
