Fix widget: refrescar timeline al guardar Quick Update y al pasar a background (build 86) #42
- QuickUpdateView.saveAll hacía context.save() directo sin pasar por SnapshotRepository → nunca llamaba a refreshWidgetData() y el widget quedaba obsoleto hasta reabrir la app - Red de seguridad: refreshWidgetData() también en scenePhase .background para cualquier otro camino de guardado directo Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VXtwQP6nYnbLFVqsHiTK5G
This commit is contained in:
@@ -96,6 +96,12 @@ struct PortfolioJournalApp: App {
|
||||
.environmentObject(balancePrivacy)
|
||||
}
|
||||
.onChange(of: scenePhase) { _, newPhase in
|
||||
if newPhase == .background {
|
||||
// Safety net for any save path that doesn't refresh the widget
|
||||
// itself: guarantee the widget is fresh whenever the app leaves
|
||||
// the foreground (WAL checkpoint + timeline reload).
|
||||
coreDataStack.refreshWidgetData()
|
||||
}
|
||||
if newPhase == .active {
|
||||
coreDataStack.refreshWidgetData()
|
||||
// Re-read all Core Data objects from the persistent store so that
|
||||
|
||||
Reference in New Issue
Block a user