Open pianostringquartet opened 3 years ago
UPDATE NOV 9: These issues also appear when using ReSwift to update state and cause rerenders.
The issue is still difficult to consistently reproduce, but appears to stem from how SwiftUI's NavigationLink's selection: Binding<T> b
param modifies the @State var b
, and how this SwiftUI-@State
-based rerendering competes with ReSwift's updates.
Workaround for now is to use other SwiftUI options (e.g. .transition
s) to imitate NavigationView and NavigationLink functionality.
CoreData and SwiftUI's NavigationLink appear not to play nicely together.
Two intermittently observed issues are described below, and I suspect that in both cases CoreData does not finish saving/creating the data before SwiftUI's NavigationLink sends us to the CoreData-dependent screen. Solutions might involve a queue or the hack workaround described here: https://stackoverflow.com/a/64051395
(There are other known issues with CoreData + SwiftUI, e.g. crashing when a reference is deleted
1. 'Plus ball' unresponsive when graph first created
When we create a new graph, occasionally we are unable to immediately move the 'plus ball' (which, when dragged, becomes a node). The UI element itself is unresponsive -- e.g. dragging the plus-ball does not trigger
onDrag
callback, clicking does not triggeronTap
callback etc.To do: confirm on different devices; may just be computer performance issues?
2. 'Plus ball' not created in time before we navigate to graph creation screen
When we create a new graph, occasionally (when?) the CoreData saving of the 'plus ball' is not completed before SwfitUI
NavigationLink
sends us to the graph creation screen. The result is that we end up with only a blank screen and a Back button. (Returning to the graph selection screen then going back to the created graph solves the issue.)To do: determine when exactly this happens and how to fix it. Might be solvable by a queue or awaiting the CD mutation completion.