Skip to content

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

Update www page leave behaviour (#29945)

Joshen Lim76d750f29547
diff --git a/apps/www/pages/_app.tsx b/apps/www/pages/_app.tsx
index f3308fffbfc..1d6cfb3592a 100644
--- a/apps/www/pages/_app.tsx
+++ b/apps/www/pages/_app.tsx
@@ -89,21 +89,20 @@ export default function App({ Component, pageProps }: AppProps) {
}, [router.isReady, consentValue])
useEffect(() => {
- if (blockEvents) return
-
const handleBeforeUnload = async () => {
- await post(`${API_URL}/telemetry/page-leave`, {
- page_url: window.location.href,
- page_title: title,
- pathname: router.pathname,
- })
+ if (!blockEvents) {
+ await post(`${API_URL}/telemetry/page-leave`, {
+ page_url: window.location.href,
+ page_title: title,
+ pathname: router.pathname,
+ })
+ }
}
window.addEventListener('beforeunload', handleBeforeUnload)
-
return () => {
window.removeEventListener('beforeunload', handleBeforeUnload)
}
- }, [])
+ }, [blockEvents, router.pathname, title])
const site_title = `${APP_NAME} | The Open Source Firebase Alternative`
const { basePath } = useRouter()