Skip to content

Cancel .task task on dispose, instead of crashing the app#420

Merged
marcprux merged 1 commit into
skiptools:mainfrom
dfabulich:task-cancellation
May 14, 2026
Merged

Cancel .task task on dispose, instead of crashing the app#420
marcprux merged 1 commit into
skiptools:mainfrom
dfabulich:task-cancellation

Conversation

@dfabulich

Copy link
Copy Markdown
Member

Fixes skiptools/skip#688

I guess we could argue about whether this is the "right thing." The old LaunchedEffect would 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:


  • AI was used to generate or assist with generating this PR. Please specify below how you used AI to help you, and what steps you have taken to manually verify the changes.

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.

@cla-bot cla-bot Bot added the cla-signed label May 10, 2026
@marcprux

Copy link
Copy Markdown
Member

I agree with the assessment. Thanks for the fix!

@marcprux marcprux merged commit fb79be5 into skiptools:main May 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cancelled .tasks crash the app

2 participants