Commit 2229e2a9b5 for woocommerce

commit 2229e2a9b5a2e6198e08bd834b2813b28e68294b
Author: Yuliyan Slavchev <yuliyan.slavchev@gmail.com>
Date:   Tue Feb 10 10:17:30 2026 +0200

    Email Editor: Memoize getEmailTemplates selector (#63200)

    * Meomize getEmailTemplates selector

    * Add changelog entry

diff --git a/packages/js/email-editor/changelog/fix-memoize-get-email-templates-selector b/packages/js/email-editor/changelog/fix-memoize-get-email-templates-selector
new file mode 100644
index 0000000000..48bd2ade4c
--- /dev/null
+++ b/packages/js/email-editor/changelog/fix-memoize-get-email-templates-selector
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Add memoization for the getEmailTemplates selector
diff --git a/packages/js/email-editor/src/store/selectors.ts b/packages/js/email-editor/src/store/selectors.ts
index 41cacc3e24..e2967afcab 100644
--- a/packages/js/email-editor/src/store/selectors.ts
+++ b/packages/js/email-editor/src/store/selectors.ts
@@ -322,21 +322,34 @@ export const getGlobalEmailStylesPost = createRegistrySelector(
 /**
  * Retrieves the email templates.
  */
-export const getEmailTemplates = createRegistrySelector( ( select ) => () => {
+export const getEmailTemplates = createRegistrySelector( ( select ) => {
 	const postType = select( storeName ).getEmailPostType();
-	return (
-		select( coreDataStore )
-			.getEntityRecords( 'postType', 'wp_template', {
-				per_page: -1,
-				post_type: postType,
-				context: 'view',
-			} )
-			// We still need to filter the templates because, in some cases, the API also returns custom templates
-			// ignoring the post_type filter in the query
-			?.filter( ( template ) =>
-				// @ts-expect-error Missing property in type
-				template.post_types.includes( postType )
-			)
+
+	return createSelector(
+		() =>
+			select( coreDataStore )
+				.getEntityRecords( 'postType', 'wp_template', {
+					per_page: -1,
+					post_type: postType,
+					context: 'view',
+				} )
+				// We still need to filter the templates because, in some cases, the API also returns custom templates
+				// ignoring the post_type filter in the query
+				?.filter( ( template ) =>
+					// @ts-expect-error Missing property in type
+					template.post_types.includes( postType )
+				),
+		() => [
+			select( coreDataStore ).getEntityRecords(
+				'postType',
+				'wp_template',
+				{
+					per_page: -1,
+					post_type: postType,
+					context: 'view',
+				}
+			),
+		]
 	);
 } );