mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-28 02:23:53 +02:00
feat: replace unified loading approach with global loading provider and refactor loading handling across components
- Introduced GlobalLoadingProvider to manage a consistent loading overlay across the application. - Replaced existing loading implementations with useGlobalLoadingEffect hook for better control and to prevent animation resets. - Updated components such as LoginPage, AuthCallbackPage, and DashboardLayout to utilize the new global loading mechanism. - Removed UnifiedLoadingScreen component to streamline loading management and enhance user experience.
This commit is contained in:
parent
2d17d1a1b6
commit
66a3c877ef
15 changed files with 294 additions and 140 deletions
|
|
@ -3,7 +3,7 @@
|
|||
import { useSearchParams } from "next/navigation";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useEffect } from "react";
|
||||
import { UnifiedLoadingScreen } from "@/components/ui/unified-loading-screen";
|
||||
import { useGlobalLoadingEffect } from "@/hooks/use-global-loading";
|
||||
import { getAndClearRedirectPath, setBearerToken } from "@/lib/auth-utils";
|
||||
import { trackLoginSuccess } from "@/lib/posthog/events";
|
||||
|
||||
|
|
@ -30,6 +30,9 @@ const TokenHandler = ({
|
|||
const t = useTranslations("auth");
|
||||
const searchParams = useSearchParams();
|
||||
|
||||
// Always show loading for this component - spinner animation won't reset
|
||||
useGlobalLoadingEffect(true, t("processing_authentication"), "default");
|
||||
|
||||
useEffect(() => {
|
||||
// Only run on client-side
|
||||
if (typeof window === "undefined") return;
|
||||
|
|
@ -69,9 +72,8 @@ const TokenHandler = ({
|
|||
}
|
||||
}, [searchParams, tokenParamName, storageKey, redirectPath]);
|
||||
|
||||
return (
|
||||
<UnifiedLoadingScreen variant="default" message={t("processing_authentication")} />
|
||||
);
|
||||
// Return null - the global provider handles the loading UI
|
||||
return null;
|
||||
};
|
||||
|
||||
export default TokenHandler;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue