From 603ebeb1235ea6c405cd7ddba0a00e8bdeb8389e Mon Sep 17 00:00:00 2001 From: guru_sainath Date: Mon, 20 May 2024 12:10:54 +0530 Subject: [PATCH] chore: handled the auto reload issue in auth-wrapper and instance wrapper (#4520) --- web/lib/wrappers/authentication-wrapper.tsx | 2 +- web/lib/wrappers/instance-wrapper.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/web/lib/wrappers/authentication-wrapper.tsx b/web/lib/wrappers/authentication-wrapper.tsx index 30c85cf8e..8dfd5771a 100644 --- a/web/lib/wrappers/authentication-wrapper.tsx +++ b/web/lib/wrappers/authentication-wrapper.tsx @@ -60,7 +60,7 @@ export const AuthenticationWrapper: FC = observer((props return redirectionRoute; }; - if (isUserSWRLoading || isUserLoading) + if ((isUserSWRLoading || isUserLoading) && !currentUser?.id) return (
diff --git a/web/lib/wrappers/instance-wrapper.tsx b/web/lib/wrappers/instance-wrapper.tsx index c0343a9e1..892838b7e 100644 --- a/web/lib/wrappers/instance-wrapper.tsx +++ b/web/lib/wrappers/instance-wrapper.tsx @@ -16,12 +16,12 @@ export const InstanceWrapper: FC = observer((props) => { // store const { isLoading, instance, error, fetchInstanceInfo } = useInstance(); - useSWR("INSTANCE_INFORMATION", () => fetchInstanceInfo(), { + const { isLoading: isInstanceSWRLoading } = useSWR("INSTANCE_INFORMATION", () => fetchInstanceInfo(), { revalidateOnFocus: false, }); // loading state - if (isLoading) + if ((isLoading || isInstanceSWRLoading) && !instance) return (