diff --git a/core/lib/Drupal/Core/Entity/EntityDisplayBase.php b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php
index 251bb00..2272e94 100644
--- a/core/lib/Drupal/Core/Entity/EntityDisplayBase.php
+++ b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php
@@ -145,8 +145,8 @@ public function id() {
    * {@inheritdoc}
    */
   public function preSave(EntityStorageInterface $storage, $update = TRUE) {
-    // Sort elements by weight before saving.
-    uasort($this->content, 'Drupal\Component\Utility\SortArray::sortByWeightElement');
+    ksort($this->content);
+    ksort($this->hidden);
     parent::preSave($storage, $update);
   }
 
