mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
fix: add condition for web vitals to ignore dev mode
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { dev } from '$app/environment';
|
||||
import { getCLS, getFCP, getFID, getLCP, getTTFB, type Metric } from 'web-vitals';
|
||||
|
||||
type Options = {
|
||||
@@ -45,6 +46,7 @@ function sendToAnalytics(metric: Metric, options: Options) {
|
||||
// This content type is necessary for `sendBeacon`
|
||||
type: 'application/x-www-form-urlencoded'
|
||||
});
|
||||
|
||||
if (navigator.sendBeacon) {
|
||||
navigator.sendBeacon(vitalsUrl, blob);
|
||||
} else
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import { redirectTo } from '$lib/stores/organization';
|
||||
import { onMount } from 'svelte';
|
||||
import { base } from '$app/paths';
|
||||
import { browser } from '$app/environment';
|
||||
import { browser, dev } from '$app/environment';
|
||||
import { app } from '$lib/stores/app';
|
||||
import Notifications from '$lib/layout/notifications.svelte';
|
||||
import Loading from './_loading.svelte';
|
||||
@@ -38,7 +38,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
$: if (browser && window.VERCEL_ANALYTICS_ID) {
|
||||
$: if (!dev && browser && window.VERCEL_ANALYTICS_ID) {
|
||||
webVitals({
|
||||
path: $page.url.pathname,
|
||||
params: $page.params,
|
||||
|
||||
Reference in New Issue
Block a user