Repository navigation
Conversation
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.
Depends on #8309. Review only this pull request's change: vjeux/astryx@58dbb1a...2e77071
Why
Astryx's gesture hooks called a component's handlers at the wrong times. A recognizer unmounted mid-gesture reported
cancelledfrom React's cleanup, and a press tracker's timer could call back after unmount, so a component could set state on something already gone. A touch that stopped a flicking list still counted as a press by default, and a component that changed a press tracker's options after mount was ignored.What led to it
This is part of the UIKit-parity work on Astryx's touch components. Reviews of #8073, #8076, a context menu and a number input found these. React's rules for Astryx say a component's callback never fires from an Effect or from cleanup (
architecture:react-component-runtimeINV2, INV3).Options and tradeoffs
Why this choice
The hooks are the only place every component passes through, so one fix covers all of them, and a press in progress survives an option change. Each recognizer's internal plumbing becomes
protected, so components can no longer call it by accident; the arena and the host reach it through one internal accessor. A press stopping a flick no longer presses, because the brake now defaults to the host's.How to check it
Evidence