From 561a6777d42b043ec41e6927ecde2aff0b73a300 Mon Sep 17 00:00:00 2001 From: phamhieu Date: Tue, 7 Feb 2023 11:19:50 +0700 Subject: [PATCH] fix: handleRouteChange and condition to send initial page event --- studio/components/ui/PageTelemetry.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/studio/components/ui/PageTelemetry.tsx b/studio/components/ui/PageTelemetry.tsx index d2e5635bb18..62f31a0a031 100644 --- a/studio/components/ui/PageTelemetry.tsx +++ b/studio/components/ui/PageTelemetry.tsx @@ -10,8 +10,8 @@ const PageTelemetry: FC = ({ children }) => { const { ui } = useStore() useEffect(() => { - function handleRouteChange() { - handlePageTelemetry(router.route) + function handleRouteChange(url: string) { + handlePageTelemetry(url) } // Listen for page changes after a navigation or when the query changes @@ -24,9 +24,9 @@ const PageTelemetry: FC = ({ children }) => { useEffect(() => { /** * Send page telemetry on first page load - * if there asPath is defined, then this isn't needed + * if the route is not ready. Don't need to send it will be picked up by router.event above */ - if (router.route === '/' && router.asPath === '/') { + if (router.isReady) { handlePageTelemetry(router.route) } }, [])