Gate analytics and cache public API requests

This commit is contained in:
2569718930@qq.com
2026-04-06 13:58:11 +08:00
parent 9be12ad1d7
commit 08d7308486
14 changed files with 114 additions and 309 deletions
@@ -4,10 +4,16 @@ import { usePathname } from "next/navigation";
import { useReportWebVitals } from "next/web-vitals";
const TRACKED_METRICS = new Set(["INP", "LCP", "FCP"]);
const WEB_VITALS_ENABLED =
process.env.NEXT_PUBLIC_POLYWEATHER_WEB_VITALS === "true";
export function WebVitalsReporter() {
const pathname = usePathname();
if (!WEB_VITALS_ENABLED) {
return null;
}
useReportWebVitals((metric) => {
if (!TRACKED_METRICS.has(metric.name)) {
return;