Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

864 B
Raw Blame
import { SessionExpiredSurface } from "@/app/components/SessionExpiredSurface";
import { useCurrentRoute } from "@/app/router";
import { useAppStore } from "@/stores/app";
import { isAuthRelatedRoute } from "@/utils/auth";

export function SessionExpiredSurfaceGate() {
  const route = useCurrentRoute();
  const isAuthRoute = isAuthRelatedRoute(String(route.name ?? ""));
  const isLoggedIn = useAppStore((s) => s.isLoggedIn());
  const unauthenticatedOccurred = useAppStore((s) => s.unauthenticatedOccurred);
  const currentPath = route.fullPath;
  // The surface is only shown for an already-signed-in user on a non-auth
  // route who just lost their session — otherwise the modal would block
  // signin/signup flows.
  if (isAuthRoute || !isLoggedIn || !unauthenticatedOccurred) return null;
  return <SessionExpiredSurface currentPath={currentPath} />;
}