Repository navigation
fix(ios): keep a setPage sent during a slide - #1238
Draft
KisaneNeko wants to merge 1 commit into
Draft
KisaneNeko wants to merge 1 commit into
KisaneNeko wants to merge 1 commit into
Conversation
Member
|
@KisaneNeko Is there anything that needs to be done in this PR? Would love to get it merged to address flaky test 🙏 |
Collaborator
Author
|
@krozniata i kept it as draft because #1234 had part of the fix, since it was merged yesterday I'll sync with main and test if the CI is back to green. |
KisaneNeko
force-pushed
the
fix/ios-redirect-reverts
branch
from
November 13, 2026 06:23
df12cef to
0bfa289
Compare
Collaborator
Author
|
@krozniata the part that I thought would be fixed with #1234 are still broken :( back to the drawing board I'll try to address it |
KisaneNeko
force-pushed
the
fix/ios-redirect-reverts
branch
from
November 13, 2026 11:46
8fe9d19 to
647aab6
Compare
While a slide runs, TabView writes the page nearest the offset into the selection, which can overwrite a setPage sent mid-slide. Stop the running slide before changing the selection. TabView also starts no scroll for a selection that is already the page nearest the offset, so a slide redirected back to the page it is passing runs on to its old target. Start that scroll from the pager, unless a slide is already heading there.
KisaneNeko
force-pushed
the
fix/ios-redirect-reverts
branch
from
November 13, 2026 15:17
84cf145 to
cb4af6f
Compare
This branch has not been deployed
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.
Summary
A
setPagesent while a slide is still running can end on the wrong page on iOS. This is the cause of the iOS e2e flakes inissue-1154-page-change-focus.e2e.tsthat remain after #1234.While a slide runs,
TabViewwrites the page nearest the offset into the selection on each scroll frame. If such a frame comes between the new selection andTabView's update, the new page is lost. Two tests send a second command right after the first:a setPage that interrupts another still lands on the later pageanda setPage redirected once the focus has landed blurs it. In CI that command often arrives while the first slide is still running. The pager then stops on page 1 instead of page 2 (selected 2, selected 1). On a fast machineTabViewapplies the selection first, which is why these tests do not fail locally.There is a second case of the same behaviour.
TabViewstarts no scroll for a selection that is already the page nearest the offset. Take a slide from 0 to 2 that is redirected to 1 past the middle of page 1. It runs on to page 2, andTabViewwrites 2 back (selected 2, selected 1, selected 2, state idle at 2).The fix:
setPagechanges the selection, the pager stops a running slide where it is.TabViewthen has no slide to take a page from, and it scrolls to the new selection.TabViewstarted no scroll and the pager is nearest the new page, the pager scrolls there itself.A slide that a finger drives or that decelerates after a swipe is left alone. iOS 15 is left alone too.
Test Plan
What's required for testing (prerequisites)?
What are the steps to reproduce (after prerequisites)?
On Issue #1154 Page Change Focus Repro, tap Go 2, back to 1. It calls
setPage(2), then callssetPage(1)fromonPageScrollonce the slide is more than halfway to page 1. Expected: the pager stops on page 1. Onmainit stops on page 2.The other case needs a slow main thread, so it shows on CI and not on a fast machine.
CI, iOS 26.4 simulator, both iOS jobs, the two flaky tests 20 times each with no retries (a temporary workflow change, since removed):
mainwith #1234With native traces from the same runs: on
main, 35 of 35 commands sent mid-slide ended on the earlier page, and 44 of 44 sent after the slide were fine. With this change the stop acted in 30 runs, and all of them passed.Locally, iPhone 17 Pro simulator, iOS 26.4, release build:
a setPage back to the page a slide is passing lands therefails 10 of 10 without the change and passes 10 of 10 with it.LOCATOR_NOT_FOUNDbefore any page change.TabView inside a ScrollView, where the tab tap sends nosetPageto the pager, and one run of the search bar inset test.Not covered: a real device, iOS versions other than 26.4, vertical paging and right to left for these redirects, and Android, which this does not touch.
Compatibility
Checklist
README.md(no documented behaviour changes)