Commit 0443c5cf10c for woocommerce

commit 0443c5cf10c44a75f4fadc0fa2895f8a97b48dcd
Author: Seun Olorunsola <30554163+triple0t@users.noreply.github.com>
Date:   Mon Jun 15 10:23:07 2026 +0200

    [Email Editor] Fix crash for users lacking edit_theme_options (#65684)

    * Fix email editor infinite re-render for users lacking edit_theme_options

    * Add changelog entry for email editor global styles fix

diff --git a/packages/js/email-editor/changelog/fix-wooprd-3501-global-styles-react-error-185 b/packages/js/email-editor/changelog/fix-wooprd-3501-global-styles-react-error-185
new file mode 100644
index 00000000000..0c6d3110cb1
--- /dev/null
+++ b/packages/js/email-editor/changelog/fix-wooprd-3501-global-styles-react-error-185
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Memoize the regularized entity record so the global styles and template selectors return a stable reference, preventing an infinite re-render loop (React error #185) for users who lack the edit_theme_options capability.
diff --git a/packages/js/email-editor/src/store/selectors.ts b/packages/js/email-editor/src/store/selectors.ts
index 7aace404055..4a2003f3f7e 100644
--- a/packages/js/email-editor/src/store/selectors.ts
+++ b/packages/js/email-editor/src/store/selectors.ts
@@ -74,15 +74,31 @@ function enhancePatternWithParsedBlocks(
 	return enhancedPattern;
 }

+// Caches the regularized record keyed on the source entity record so repeated
+// calls with the same (referentially stable) record return the same object.
+// `@wordpress/core-data` memoizes `getEntityRecord`, so without this cache the
+// spread below would produce a new object on every selector call. That breaks
+// the referential stability `useSelect` relies on and drives an infinite
+// re-render loop (React error #185) for users who lack `edit_theme_options`,
+// because the `context: 'view'` branch — unlike `getEditedEntityRecord` — is
+// not otherwise memoized.
+const regularizedRecordCache = new WeakMap< object, object >();
+
 function regularizedGetEntityRecord( template ) {
 	if ( ! template ) {
 		return null;
 	}
-	return {
+	const cached = regularizedRecordCache.get( template );
+	if ( cached ) {
+		return cached;
+	}
+	const regularized = {
 		...template,
 		title: template?.title?.raw || template?.title || '',
 		content: template?.content?.raw || template?.content || '',
 	};
+	regularizedRecordCache.set( template, regularized );
+	return regularized;
 }

 export const isFeatureActive = createRegistrySelector(