From 3d21a067897e4aa24f6404686ca6896044584796 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Wed, 3 May 2023 10:02:15 +0200 Subject: [PATCH] fix(front): Handle "Failed to fetch dynamically imported module" errors by refreshing the page Reference: https://stackoverflow.com/a/74861436/10204399 Signed-off-by: Thomas Citharel --- js/src/router/index.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/js/src/router/index.ts b/js/src/router/index.ts index b9ed1ca1..bb10b78d 100644 --- a/js/src/router/index.ts +++ b/js/src/router/index.ts @@ -205,3 +205,12 @@ router.beforeEach(authGuardIfNeeded); // console.error(e); // } // }); + +router.onError((error, to) => { + if ( + error.message.includes("Failed to fetch dynamically imported module") || + error.message.includes("Importing a module script failed") + ) { + window.location.href = to.fullPath; + } +});