From 98eef9c366d23b5a2f89fa90e12fb7a7ac6f7bfb Mon Sep 17 00:00:00 2001 From: Usman Baig Date: Sat, 21 Feb 2026 19:50:27 +0100 Subject: [PATCH] feat: adjust default data retention to 6 months in SiteSettingsPage and add error handling for subscription loading failures --- app/sites/[id]/settings/page.tsx | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/app/sites/[id]/settings/page.tsx b/app/sites/[id]/settings/page.tsx index 3e9c790..95ee5ce 100644 --- a/app/sites/[id]/settings/page.tsx +++ b/app/sites/[id]/settings/page.tsx @@ -71,10 +71,11 @@ export default function SiteSettingsPage() { enable_performance_insights: false, // Bot and noise filtering filter_bots: true, - // Data retention - data_retention_months: 12 + // Data retention (6 = free-tier max; safe default) + data_retention_months: 6 }) const [subscription, setSubscription] = useState(null) + const [subscriptionLoadFailed, setSubscriptionLoadFailed] = useState(false) const [linkCopied, setLinkCopied] = useState(false) const [snippetCopied, setSnippetCopied] = useState(false) const [showVerificationModal, setShowVerificationModal] = useState(false) @@ -99,9 +100,11 @@ export default function SiteSettingsPage() { const loadSubscription = async () => { try { + setSubscriptionLoadFailed(false) const sub = await getSubscription() setSubscription(sub) } catch (e) { + setSubscriptionLoadFailed(true) toast.error(getAuthErrorMessage(e as Error) || 'Could not load plan limits. Showing default options.') } } @@ -139,8 +142,8 @@ export default function SiteSettingsPage() { enable_performance_insights: data.enable_performance_insights ?? false, // Bot and noise filtering (default to true) filter_bots: data.filter_bots ?? true, - // Data retention - data_retention_months: data.data_retention_months ?? 12 + // Data retention (default 6 = free-tier max; avoids flash-then-clamp for existing sites) + data_retention_months: data.data_retention_months ?? 6 }) if (data.has_password) { setIsPasswordEnabled(true) @@ -855,6 +858,20 @@ export default function SiteSettingsPage() { {/* Data Retention */}

Data Retention

+ {subscriptionLoadFailed && ( +
+

+ Plan limits could not be loaded. Options shown may be limited. +

+ +
+ )}