From c5d0c7fe8d063502de94f8b7b9ae790d1265923e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Wouts?= Date: Fri, 16 Jun 2023 22:58:59 +1000 Subject: [PATCH] perf: allow detectComponents() to free event loop (#1739) --- framework-plugins/preact/src/index.ts | 2 ++ framework-plugins/react/src/index.ts | 2 ++ framework-plugins/solid/src/index.ts | 2 ++ framework-plugins/svelte/src/index.ts | 2 ++ framework-plugins/vue2/src/index.ts | 2 ++ framework-plugins/vue3/src/index.ts | 2 ++ 6 files changed, 12 insertions(+) diff --git a/framework-plugins/preact/src/index.ts b/framework-plugins/preact/src/index.ts index 6bf6c1bc769..6a73c330719 100644 --- a/framework-plugins/preact/src/index.ts +++ b/framework-plugins/preact/src/index.ts @@ -43,6 +43,8 @@ const preactFrameworkPlugin: FrameworkPluginFactory = { absoluteFilePath ) ); + // Ensure this potentially long-running function doesn't block the thread. + await 0; } return components; }, diff --git a/framework-plugins/react/src/index.ts b/framework-plugins/react/src/index.ts index 3334468473f..c843914f014 100644 --- a/framework-plugins/react/src/index.ts +++ b/framework-plugins/react/src/index.ts @@ -62,6 +62,8 @@ const reactFrameworkPlugin: FrameworkPluginFactory = { absoluteFilePath ) ); + // Ensure this potentially long-running function doesn't block the thread. + await 0; } return components; }, diff --git a/framework-plugins/solid/src/index.ts b/framework-plugins/solid/src/index.ts index 5af8175e9ab..f0014b56900 100644 --- a/framework-plugins/solid/src/index.ts +++ b/framework-plugins/solid/src/index.ts @@ -43,6 +43,8 @@ const solidFrameworkPlugin: FrameworkPluginFactory = { absoluteFilePath ) ); + // Ensure this potentially long-running function doesn't block the thread. + await 0; } return components; }, diff --git a/framework-plugins/svelte/src/index.ts b/framework-plugins/svelte/src/index.ts index 69d2638c349..9f63a5b0a68 100644 --- a/framework-plugins/svelte/src/index.ts +++ b/framework-plugins/svelte/src/index.ts @@ -54,6 +54,8 @@ const svelteFrameworkPlugin: FrameworkPluginFactory = { absoluteFilePath )) ); + // Ensure this potentially long-running function doesn't block the thread. + await 0; } return components; }, diff --git a/framework-plugins/vue2/src/index.ts b/framework-plugins/vue2/src/index.ts index 9e0111d6771..da6bdf510db 100644 --- a/framework-plugins/vue2/src/index.ts +++ b/framework-plugins/vue2/src/index.ts @@ -55,6 +55,8 @@ const vue2FrameworkPlugin: FrameworkPluginFactory = { absoluteFilePath ) ); + // Ensure this potentially long-running function doesn't block the thread. + await 0; } return components; }, diff --git a/framework-plugins/vue3/src/index.ts b/framework-plugins/vue3/src/index.ts index b4c98be0f21..3f1a74c1470 100644 --- a/framework-plugins/vue3/src/index.ts +++ b/framework-plugins/vue3/src/index.ts @@ -57,6 +57,8 @@ const vue3FrameworkPlugin: FrameworkPluginFactory = { absoluteFilePath ) ); + // Ensure this potentially long-running function doesn't block the thread. + await 0; } return components; },