From 87e5b33a3b2c7d65803394d8209449de2e85a0a4 Mon Sep 17 00:00:00 2001 From: Tanner Reits <47483144+tanner-reits@users.noreply.github.com> Date: Thu, 13 Jun 2024 15:34:56 -0400 Subject: [PATCH] fix(runtime): catch errors in async lifecycle methods (#5826) --- 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