[WIP] Fix tab crash when index changes before layout#152947
Closed
Piinks wants to merge 1 commit intoflutter:masterfrom
Closed
[WIP] Fix tab crash when index changes before layout#152947Piinks wants to merge 1 commit intoflutter:masterfrom
Piinks wants to merge 1 commit intoflutter:masterfrom
Conversation
chunhtai
reviewed
Aug 6, 2024
| // Dispose if we had one already, this can happen if the index of the tab | ||
| // controller, which sets _currentIndex, changes before we have laid out. | ||
| _pageController?.dispose(); | ||
| _pageController = PageController( |
Contributor
There was a problem hiding this comment.
Instead of doing this, can _pageController somehow sets its _PagePosition's _pageToUseOnStartup if the viewport dimension is not yet applied?
| if (_controller!.index != _currentIndex) { | ||
| _currentIndex = _controller!.index; | ||
| _warpToCurrentIndex(); | ||
| if (_pageCanChange()) { |
Contributor
There was a problem hiding this comment.
what happen if this is false? do we just drop the change?
auto-submit bot
pushed a commit
that referenced
this pull request
Aug 7, 2024
…s are set (#153017) ## Description This PR fixes `PageController` throwing when using `jumpToPage` or `animateToPage` to switch page before the viewport dimensions were retrieved. Solution based on #152947 (comment). ## Related Issue Fixes #86222. Fixes #152079 ## Tests Adds 2 tests.
TytaniumDev
pushed a commit
to TytaniumDev/flutter
that referenced
this pull request
Aug 7, 2024
…s are set (flutter#153017) ## Description This PR fixes `PageController` throwing when using `jumpToPage` or `animateToPage` to switch page before the viewport dimensions were retrieved. Solution based on flutter#152947 (comment). ## Related Issue Fixes flutter#86222. Fixes flutter#152079 ## Tests Adds 2 tests.
DBowen33
pushed a commit
to DBowen33/flutter
that referenced
this pull request
Aug 16, 2024
…s are set (flutter#153017) ## Description This PR fixes `PageController` throwing when using `jumpToPage` or `animateToPage` to switch page before the viewport dimensions were retrieved. Solution based on flutter#152947 (comment). ## Related Issue Fixes flutter#86222. Fixes flutter#152079 ## Tests Adds 2 tests.
Buchimi
pushed a commit
to Buchimi/flutter
that referenced
this pull request
Sep 2, 2024
…s are set (flutter#153017) ## Description This PR fixes `PageController` throwing when using `jumpToPage` or `animateToPage` to switch page before the viewport dimensions were retrieved. Solution based on flutter#152947 (comment). ## Related Issue Fixes flutter#86222. Fixes flutter#152079 ## Tests Adds 2 tests.
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.
WIP - I am not sure this is the right fix, as I've worked on it it's grown in complexity.
This issue is urgent for an internal customer (b/357067239)
This crash can happen from multiple code paths, the customer issue does not have a repro, but I found two in the issue tracker:
TabBarViewcrashes when switching index before layout #86222I think these PRs are related, which is why the CC for @bleroux & @chunhtai - what do you two think here? I broke 3 tests here, not sure if this is the right way to go.
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.