diff --git a/apps/web/src/contexts/boundary/Boundary.tsx b/apps/web/src/contexts/boundary/Boundary.tsx index 1179f3e2cd..c0eb0ce08f 100644 --- a/apps/web/src/contexts/boundary/Boundary.tsx +++ b/apps/web/src/contexts/boundary/Boundary.tsx @@ -1,14 +1,35 @@ -import { memo, PropsWithChildren, Suspense } from 'react'; +import { useRouter } from 'next/router'; +import { memo, PropsWithChildren, Suspense, useMemo } from 'react'; import FullPageLoader from '~/components/core/Loader/FullPageLoader'; import ErrorBoundary from './ErrorBoundary'; -const Boundary = memo(({ children }: PropsWithChildren) => ( - }> - {children} - -)); +const NO_FULL_PAGE_LOADER_PATHS = ['/features']; + +const isPathExcluded = (pathname: string) => { + return NO_FULL_PAGE_LOADER_PATHS.some((path) => pathname.startsWith(path)); +}; + +const Boundary = memo(({ children }: PropsWithChildren) => { + const { pathname } = useRouter(); + + const isFullPageLoaderExcluded = useMemo(() => isPathExcluded(pathname), [pathname]); + + if (isFullPageLoaderExcluded) { + return ( + + {children}; + + ); + } + + return ( + }> + {children} + + ); +}); Boundary.displayName = 'Boundary';