Fix GA4: screen_view de Dashboard fuera de refreshData() (build 87) #44

logScreenView('Dashboard') estaba dentro de refreshData(), que se re-ejecuta con cada cambio de CoreData (incl. imports de iCloud, debounce 500ms) — 2 iPads con la app abierta generaban 1.400-2.100 views fantasma/día. Movido a DashboardView.onAppear (una vez por aparición), como el resto de pantallas.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VXtwQP6nYnbLFVqsHiTK5G
This commit is contained in:
alexandrev-tibco
2026-09-10 06:34:21 +02:00
parent 6dd755234a
commit eaf0c8f93b
3 changed files with 17 additions and 12 deletions
@@ -112,6 +112,9 @@ struct DashboardView: View {
goalsViewModel.selectedAccount = accountStore.selectedAccount
goalsViewModel.showAllAccounts = accountStore.showAllAccounts
goalsViewModel.refresh()
// Screen view logged here (once per appearance) NOT inside
// refreshData(), which re-runs on every Core Data change.
FirebaseService.shared.logScreenView(screenName: "Dashboard")
}
// Performance: Combine account selection changes into a single handler
.onChange(of: accountStore.selectedAccount) { _, newAccount in