Fix main graph locking up after system-cancelled gestures - #733
Open
bjorkert wants to merge 1 commit into
Open
Conversation
When the system cancels a touch (permission alert, incoming call, app switch) the chart gestures never get their onEnded call, so pinch or inspect state stays latched and blocks all panning and zooming until the app is restarted. Clear leaked gesture state when a new touch begins, reset it when the chart disappears, and rebuild the gesture attachments on foregrounding while keeping the current viewport.
marionbarker
approved these changes
Jul 29, 2026
marionbarker
left a comment
Collaborator
There was a problem hiding this comment.
Accepting code from @bjorkert .
Test by building and using the main-screen zoom and scroll features.
- ✅ Mac Catalyst (not the pinch part)
- ✅ SE 2nd gen, iOS 18, Loop URL
- ✅ SE 3rd gen, iOS 26, Trio URL
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.
A few times the main graph has stopped responding to panning and zooming while the small graph could still move it, and only an app restart would unlock it. The cause is that SwiftUI gestures never receive onEnded when the system cancels a touch, for example from a permission alert, an incoming call or an app switch. The pinch or inspect state then stays latched and swallows every following touch, and in the worst case the gesture system for the view stops delivering events entirely.
This change clears leaked gesture state whenever a new touch begins, resets it when the chart disappears, and rebuilds the chart's gesture attachments when the app returns to the foreground. The current position and zoom are kept across that rebuild, so nothing changes visually.