- Add `prefix` param to checkRateLimit/getRateLimitHeaders so each endpoint
has its own bucket (previously all shared `admin_${ip}`, causing 429s when
analytics/track incremented past n8n endpoints' lower limits)
- n8n/hardcover/currently-reading → prefix 'n8n-reading'
- n8n/status → prefix 'n8n-status'
- analytics/track → prefix 'analytics-track'
- Remove custom analytics system (AnalyticsProvider, lib/analytics,
lib/useWebVitals, all /api/analytics/* routes) — was causing 500s in
production due to missing PostgreSQL PageView table
- Remove analytics consent toggle from ConsentBanner/ConsentProvider
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
42 lines
894 B
TypeScript
42 lines
894 B
TypeScript
"use client";
|
|
|
|
import React, { useEffect, useState } from "react";
|
|
|
|
const ToastProvider = React.lazy(() =>
|
|
import("@/components/Toast").then((mod) => ({
|
|
default: mod.ToastProvider,
|
|
}))
|
|
);
|
|
|
|
const BackgroundBlobs = React.lazy(() =>
|
|
import("@/components/BackgroundBlobs")
|
|
);
|
|
|
|
const ChatWidget = React.lazy(() => import("./ChatWidget"));
|
|
|
|
export default function RootProviders({
|
|
children,
|
|
}: {
|
|
children: React.ReactNode;
|
|
}) {
|
|
const [mounted, setMounted] = useState(false);
|
|
|
|
useEffect(() => {
|
|
setMounted(true);
|
|
}, []);
|
|
|
|
if (!mounted) {
|
|
return <div className="relative z-10">{children}</div>;
|
|
}
|
|
|
|
return (
|
|
<React.Suspense fallback={<div className="relative z-10">{children}</div>}>
|
|
<ToastProvider>
|
|
<BackgroundBlobs />
|
|
<div className="relative z-10">{children}</div>
|
|
<ChatWidget />
|
|
</ToastProvider>
|
|
</React.Suspense>
|
|
);
|
|
}
|