diff --git a/core/lib/Drupal/Core/Form/FormCache.php b/core/lib/Drupal/Core/Form/FormCache.php
index 13e5430..366aabb 100644
--- a/core/lib/Drupal/Core/Form/FormCache.php
+++ b/core/lib/Drupal/Core/Form/FormCache.php
@@ -183,6 +183,10 @@ public function setCache($form_build_id, $form, FormStateInterface $form_state)
       return;
     }
 
+    if ($data = $form_state->getCacheableArray()) {
+      $this->keyValueExpirableFactory->get('form_state')->setWithExpire($form_build_id, $data, $expire);
+    }
+
     // Cache form structure.
     if (isset($form)) {
       if ($this->currentUser->isAuthenticated()) {
@@ -191,10 +195,6 @@ public function setCache($form_build_id, $form, FormStateInterface $form_state)
       unset($form['#build_id_old']);
       $this->keyValueExpirableFactory->get('form')->setWithExpire($form_build_id, $form, $expire);
     }
-
-    if ($data = $form_state->getCacheableArray()) {
-      $this->keyValueExpirableFactory->get('form_state')->setWithExpire($form_build_id, $data, $expire);
-    }
   }
 
   /**
