mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-04 19:21:51 +00:00
49309b43d3
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>
26 lines
843 B
TypeScript
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;
|
|
}
|