Files
Alan Buscaglia 49309b43d3 feat(ui): UI onboarding system (#11430)
Co-authored-by: Pablo F.G <pablo.fernandez@prowler.com>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Co-authored-by: alejandrobailo <alejandrobailo94@gmail.com>
Co-authored-by: Alejandro Bailo <59607668+alejandrobailo@users.noreply.github.com>
2026-06-15 13:53:48 +02:00

26 lines
843 B
TypeScript

"use client";
import { usePathname } from "next/navigation";
import { useMountEffect } from "@/hooks/use-mount-effect";
import { usePageReadyStore } from "@/store/page-ready";
/**
* Invisible marker rendered inside a page's post-Suspense (data-loaded) content.
* While it is unmounted the route counts as "still loading", which the navbar uses
* to keep the product-tour replay icon disabled until the page's requests resolve.
* Mounting marks the route ready; unmounting (navigation / in-page re-suspense) clears it.
*/
export function PageReady() {
const pathname = usePathname();
const markReady = usePageReadyStore((state) => state.markReady);
const clearReady = usePageReadyStore((state) => state.clearReady);
useMountEffect(() => {
markReady(pathname);
return () => clearReady(pathname);
});
return null;
}