Widget AppIntent updates SwiftData container, but App UI does not refresh

I'm using the new interactive widgets to trigger an app intent (tap a widget button, swift data model updates). If I tap the widget while the app is not running, then launch the app, the views (populated by an @Query) will show the correct data. However, if the app is running before tapping the widget button, the app's @Query will not refresh and so the app shows stale data. If I quit the app and relaunch it, or otherwise trigger a refresh of the query, then the view will update.

Does anyone have a way to get the app to notice when an App Intent has changed Swift Data values outside of the main app?

edit: Reported as FB13278891

This appears to be the same issue reported here: https://developer.apple.com/forums/thread/737245

I'm experiencing the same issue. I assumed it might be related to the context and implemented it as a singleton to maintain the context, but the problem persists. I'm wondering if it needs to be executed on the main thread.

I solved my issue by running the perform on the @MainActor.

Widget AppIntent updates SwiftData container, but App UI does not refresh
 
 
Q