From 0fe27759582fc35bdb8e0a0499923a0b690b10ac Mon Sep 17 00:00:00 2001
From: troublemaker52025 <troublemaker52025@outlook.com>
Date: Fri, 8 Sep 2023 18:44:16 +0800
Subject: [PATCH] Revert "Resolved error when getting length for Record type
 (#16213)"

This reverts commit b57d5ab8cae8b6d77b1dd6a7cca52f5b999d5672.
---
 cocos/render-scene/scene/submodel.ts | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/cocos/render-scene/scene/submodel.ts b/cocos/render-scene/scene/submodel.ts
index 66a026c2fb8..a1e51f42617 100644
--- a/cocos/render-scene/scene/submodel.ts
+++ b/cocos/render-scene/scene/submodel.ts
@@ -333,12 +333,10 @@ export class SubModel {
         if (!this._globalPatches && pipelinePatches.length === 0) {
             return;
         } else if (pipelinePatches.length) {
-            if (this._globalPatches) {
+            if (this._globalPatches && pipelinePatches.length === this._globalPatches.length) {
                 const globalPatches = Object.entries(this._globalPatches);
-                if (pipelinePatches.length === globalPatches.length) {
-                    const patchesStateUnchanged = JSON.stringify(pipelinePatches.sort()) === JSON.stringify(globalPatches.sort());
-                    if (patchesStateUnchanged) return;
-                }
+                const patchesStateUnchanged = JSON.stringify(pipelinePatches.sort()) === JSON.stringify(globalPatches.sort());
+                if (patchesStateUnchanged) return;
             }
         }
         this._globalPatches = pipeline.macros;