From faa90eccd363b635b84be2162376645d6a83ad55 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Wed, 1 Mar 2023 01:26:13 -0300 Subject: feat: Crash Handler (#531) Co-authored-by: Ven --- src/components/handleComponentFailed.ts | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) (limited to 'src/components') diff --git a/src/components/handleComponentFailed.ts b/src/components/handleComponentFailed.ts index 020e8ef..43a3ad8 100644 --- a/src/components/handleComponentFailed.ts +++ b/src/components/handleComponentFailed.ts @@ -16,29 +16,12 @@ * along with this program. If not, see . */ -import { isOutdated, rebuild, update } from "@utils/updater"; +import { maybePromptToUpdate } from "@utils/updater"; -export async function handleComponentFailed() { - if (isOutdated) { - setImmediate(async () => { - const wantsUpdate = confirm( - "Uh Oh! Failed to render this Page." + - " However, there is an update available that might fix it." + - " Would you like to update and restart now?" - ); - if (wantsUpdate) { - try { - await update(); - await rebuild(); - if (IS_WEB) - location.reload(); - else - DiscordNative.app.relaunch(); - } catch (e) { - console.error(e); - alert("That also failed :( Try updating or reinstalling with the installer!"); - } - } - }); - } +export function handleComponentFailed() { + maybePromptToUpdate( + "Uh Oh! Failed to render this Page." + + " However, there is an update available that might fix it." + + " Would you like to update and restart now?" + ); } -- cgit