From c5dfc020857260b4693bdfc07648e079e2032830 Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Wed, 21 Aug 2024 13:14:17 +0500 Subject: [PATCH] web: minor refactors --- apps/web/src/root.tsx | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/apps/web/src/root.tsx b/apps/web/src/root.tsx index 3618819481..8af0c64f15 100644 --- a/apps/web/src/root.tsx +++ b/apps/web/src/root.tsx @@ -94,16 +94,13 @@ function RouteWrapper(props: { }) { const { component, path, routeProps } = props; const result = usePromise(async () => { - await import("./hooks/use-database").then(({ loadDatabase }) => - loadDatabase( - path !== "/sessionexpired" || Config.get("sessionExpired", false) - ? "db" - : "memory" - ) + const { loadDatabase } = await import("./hooks/use-database"); + await loadDatabase( + path !== "/sessionexpired" || Config.get("sessionExpired", false) + ? "db" + : "memory" ); - - const { default: Component } = await component(); - return Component; + return (await component()).default; }, [component, path]); if (result.status === "rejected") {