If i manually call context.save() after an insert or update the data is persisted. I don’t think I am missing anything here.
import SwiftUI
import SwiftData
@main
struct SwiftDataDemoApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
                .modelContainer(for: DataItem.self)
        }
    }
}