[PULSE-58] Data retention settings in Site Settings #33
@@ -109,7 +109,7 @@ export default function SiteSettingsPage() {
|
||||
}
|
||||
}
|
||||
|
||||
// * Clamp data_retention_months when subscription loads: if current value exceeds plan max, sync to max
|
||||
// * Snap data_retention_months to nearest valid option when subscription loads
|
||||
useEffect(() => {
|
||||
if (!subscription) return
|
||||
const opts = getRetentionOptionsForPlan(subscription.plan_id)
|
||||
@@ -117,7 +117,8 @@ export default function SiteSettingsPage() {
|
||||
const maxVal = Math.max(...values)
|
||||
setFormData(prev => {
|
||||
if (values.includes(prev.data_retention_months)) return prev
|
||||
return { ...prev, data_retention_months: Math.min(prev.data_retention_months, maxVal) }
|
||||
const bestFit = values.filter(v => v <= prev.data_retention_months).pop() ?? maxVal
|
||||
return { ...prev, data_retention_months: Math.min(bestFit, maxVal) }
|
||||
})
|
||||
}, [subscription])
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ export function generatePrivacySnippet(site: Site): string {
|
||||
const screen = site.collect_screen_resolution ?? true
|
||||
|
|
||||
const perf = site.enable_performance_insights ?? false
|
||||
const filterBots = site.filter_bots ?? true
|
||||
const retentionMonths = site.data_retention_months ?? 12
|
||||
const retentionMonths = site.data_retention_months ?? 6
|
||||
|
||||
const parts: string[] = []
|
||||
if (paths) parts.push('which pages are viewed')
|
||||
|
||||
Reference in New Issue
Block a user
Mismatched default retention value
The fallback here is
?? 12(12 months), but the settings page (page.tsx:146) defaults to?? 6(6 months). For existing sites that haven't saved adata_retention_monthsvalue yet, the privacy snippet will claim "Raw event data is automatically deleted after 1 year" while the settings page displays and saves "6 months."These should use the same default to avoid misleading the user's privacy policy text.
Prompt To Fix With AI
Issue: The privacy snippet defaulted to 12 months while the settings page defaults to 6, so unsaved sites could show "1 year" in the snippet but "6 months" in the UI.
Fix: Use
?? 6to match the settings page default.Why: Keeps defaults aligned so the generated privacy text matches what the user sees in settings.