fix(modal): prevent sheet gesture crash with late-bound breakpoints#31202
Open
ShaneK wants to merge 1 commit into
Open
fix(modal): prevent sheet gesture crash with late-bound breakpoints#31202ShaneK wants to merge 1 commit into
ShaneK wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
3 tasks
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.
Issue number: internal
What is the current behavior?
Currently, when an
ion-modal'sbreakpointsare set after the component has loaded,sortedBreakpointsstays empty.breakpointsChangedhad no@Watch, so it only ran once from the manual call incomponentDidLoad.present()still recalculatesisSheetModaltotruefrom the late-setbreakpoints(added in #30839), so the sheet gesture initializes with an empty breakpoints array and throwsReduce of empty array with no initial valueon thebreakpoints.reduce(...)insheet.tswhen the sheet is swiped, which breaks swiping entirely.This shows up with framework bindings that land after the web component loads, e.g., an inline
ion-modalinside an Angular component rendered through a plainrouter-outletwith zoneless change detection. It doesn't reproduce with zone change detection, withModalController.create, or with the modal insideion-router-outlet, since those setbreakpointsbefore the modal presents.What is the new behavior?
Now
breakpointsChangedhas@Watch('breakpoints'), sobreakpointsset after the component loads updatesortedBreakpoints. This mirrors howtrigger/triggerChangedalready handles late binding (a watch plus a manual call incomponentDidLoad). The sheet gesture then gets the real breakpoints and swiping works.Does this introduce a breaking change?
Other information
Sheet modal preview:
Note that the preview won't show this working, but will show the modal at least isn't broken from this change.
Current dev build: