This is a very interesting question, and you've done a great job of isolating the behavior and providing comparative examples. I’m not an expert on SwiftUI, wish I knew better, but that technology was always being really good at what you're seeing this double update with @Observable and @State, especially in conjunction with GeometryReader. When @Published properties change, they emit events. Views that are observing these properties (via @StateObject or @EnvironmentObject) then get scheduled for re-evaluation. The update cycle is generally more straightforward: state change -> event -> view re-render. filteredAlbums id: [3878E7A7-CDAB-444F-8B8C-263763735770, 1, 2, 3, 4, 5, 6] filteredAlbums id: [1, 2, 3, 4, 5, 6] You've triggered two state changes almost simultaneously: albumStore.addAlbum(newAlbum): This is a change to a property managed by your @Observable AlbumStore. albumToAdd = newAlbum: This is a change to a @State property within your view. Your carousel() function reads from albumStore
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: