From 1017232e319a35c441e7cf65dca2493ffa73cef7 Mon Sep 17 00:00:00 2001 From: Tanner Reits Date: Wed, 12 Jun 2024 13:33:22 -0400 Subject: [PATCH] fix(runtime): catch errors in async lifecycle methods --- src/runtime/update-component.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/runtime/update-component.ts b/src/runtime/update-component.ts index 3220c0390d2..3da74637433 100644 --- a/src/runtime/update-component.ts +++ b/src/runtime/update-component.ts @@ -137,7 +137,12 @@ const dispatchHooks = (hostRef: d.HostRef, isInitialLoad: boolean): Promise | undefined, fn: () => Promise): Promise | undefined => - isPromisey(maybePromise) ? maybePromise.then(fn) : fn(); + isPromisey(maybePromise) + ? maybePromise.then(fn).catch((err) => { + console.error(err); + fn(); + }) + : fn(); /** * Check that a value is a `Promise`. To check, we first see if the value is an