-
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
bugSomething isn't workingSomething isn't workingenhancementNew feature or requestNew feature or request
Description
Bug Description
The analytics view only shows data from the initial load and doesn't update when changes are made to the donation status of items. Currently, there's no way for users to refresh the analytics data without restarting the app.
Current Behavior
- Analytics data loads when first opening the analytics view
- After marking items as donated/undonated, these changes aren't reflected in the analytics
- There's no refresh button or mechanism to update the analytics view
Steps to Reproduce
- Open the app and navigate to the analytics view
- Note the current donation counts and percentages
- Exit analytics, mark several items as donated
- Return to the analytics view
- Observe that the analytics data hasn't updated to include the new donations
Expected Behavior
Either:
- The analytics view should automatically refresh when it becomes visible again, or
- A refresh button should be provided to allow users to manually update the analytics data
Possible Causes
In AnalyticsDashboardView.swift, data is only loaded on onAppear and when the currentTown changes, but not when returning to the view after making changes:
.onAppear {
loadData()
}
.onChange(of: dataManager.currentTown) { _, _ in
loadData()
}Additionally, when marking items as donated, the analytics cache might not be properly invalidated.
Proposed Fix
- Add a refresh button to the
AnalyticsDashboardViewtoolbar:
.toolbar {
ToolbarItem {
Button(action: {
loadData()
}) {
Image(systemName: "arrow.clockwise")
}
}
}- Ensure proper cache invalidation in
DataManager.swiftwhen donation status changes:
// In all updateXXXDonationStatus methods:
analyticsService.invalidateCache()Priority
Medium - Affects functionality but there's a workaround (restarting the app)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingenhancementNew feature or requestNew feature or request