-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
async dispatch causes loss of change (SwiftUI, macOS) #27
Comments
I forget what this line does exactly, but it without it I’ve seen really odd issues in my text editor on iOS at least. I wouldn’t remove the code, maybe add a check for macOS or iOS and run the code when on iOS. This is safer than just removing the call completely. |
Well I've got to support iOS too, so I'll try to get to the bottom of it. I think it's pretty strange to be doing async stuff there. |
Okay after some looking I found the commit that added this for my editor. I believe the reason for it was an issue with SwiftUI crashing when it was not accessed from the main thread. Which can sometimes occur. |
Ok, what about using Also, why would I want a callback on another thread?
|
@ActuallyZach , do you know the circumstances under which |
Sourceful/Sources/Sourceful/SwiftUI/SourceCodeTextEditor.swift
Line 139 in 04f7e85
This line causes an occasional loss of a change with SwiftUI on macOS, presumably due to reordering of updates. After typing a character, the change is undone.
Why was the line needed? There isn't a comment in the code or an explanation in the change description. On macOS, SyntaxTextView.Coordinator.didChangeText is already called on the main thread.
There's this clue:
// allow the client to decide on thread
... but I'm still not sure the intent.@andreweades
thanks!
The text was updated successfully, but these errors were encountered: