Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix: handleRouteChange and condition to send initial page event

phamhieu561a6777d42b
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)
}
}, [])