Render the landing page without a Base44 session

LandingPage is pure marketing markup — no entity reads, no useAuth — but it sat
below both gates in AuthenticatedApp, so anonymous visitors were held on the
spinner for a bootstrap round-trip and then redirected to Google before they
could read anything about the product.

Check the path against a PUBLIC_ROUTES set first and return early. Its CTAs
still point at /Dashboard, which stays gated, so signing in is one click away.

Drops the old /LandingPage block that sat below the auth gate; the early return
makes it unreachable, as the previous ordering already did.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-17 20:37:10 +05:30
parent 3c649fc123
commit 015da4e68b

View File

@@ -50,10 +50,34 @@ const LayoutWrapper = ({ children, currentPageName }) => Layout ?
<Layout currentPageName={currentPageName}>{children}</Layout> <Layout currentPageName={currentPageName}>{children}</Layout>
: <>{children}</>; : <>{children}</>;
// Routes that render for anyone, signed in or not. LandingPage is pure marketing
// markup — it reads no entities and never touches useAuth — so the only thing the
// auth gate ever did for it was bounce visitors to a Google login before they
// could read what the product is. Its CTAs point at /Dashboard, which is still
// gated, so signing in stays one click away.
const PUBLIC_ROUTES = new Set(['/LandingPage']);
const isPublicRoute = (pathname) => {
// Tolerate a trailing slash so /LandingPage/ isn't quietly sent to login.
const normalized = pathname.length > 1 ? pathname.replace(/\/+$/, '') : pathname;
return PUBLIC_ROUTES.has(normalized);
};
const AuthenticatedApp = () => { const AuthenticatedApp = () => {
const { isLoadingAuth, isLoadingPublicSettings, authError, isAuthenticated, navigateToLogin } = useAuth(); const { isLoadingAuth, isLoadingPublicSettings, authError, isAuthenticated, navigateToLogin } = useAuth();
const location = useLocation(); const location = useLocation();
// Ahead of both gates below. The spinner would stall this page on a network
// round-trip it has no use for, and the auth gate would redirect away from it —
// either one defeats the point of a public page.
if (isPublicRoute(location.pathname)) {
return (
<Routes>
<Route path="/LandingPage" element={<LandingPage />} />
</Routes>
);
}
// Show loading spinner while checking app public settings or auth // Show loading spinner while checking app public settings or auth
if (isLoadingPublicSettings || isLoadingAuth) { if (isLoadingPublicSettings || isLoadingAuth) {
return ( return (
@@ -92,14 +116,6 @@ const AuthenticatedApp = () => {
// Render the main app // Render the main app
if (location.pathname === '/LandingPage') {
return (
<Routes>
<Route path="/LandingPage" element={<LandingPage />} />
</Routes>
);
}
return ( return (
<LayoutWrapper currentPageName={mainPageKey}> <LayoutWrapper currentPageName={mainPageKey}>
<Routes> <Routes>