Cancel .task task on dispose, instead of crashing the app#420
Merged
Conversation
Member
|
I agree with the assessment. Thanks for the fix! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes skiptools/skip#688
I guess we could argue about whether this is the "right thing." The old
LaunchedEffectwould cause a Kotlin cancellation to happen when the view left the component tree. Swift task cancellation is cooperative, asking implementors to remember to call Task.isCancelled / Task.checkCancellation(); typical Kotlin APIs are not going to have the foresight to check this. Intuitively, it would be better to actually "cancel" these tasks.IMO, it's more important to prevent the app from crashing than it is to correctly manage cancellation.
Skip Pull Request Checklist:
swift testI "checked", but I can't tell, because of Skip Fuse: State not updating correctly in view under NavigationLink skip#687
Cursor did this one. I tested the Skip Lite version using the Skip Lite repro. I didn't test the Skip Fuse version, because skiptools/skip#687 prevents me from even reproducing skiptools/skip#688 in the first place.