Skip to content

Fix out-of-bounds crash when revealing a navigated Reader comment#25609

Open
crazytonyli wants to merge 5 commits into
trunkfrom
bugfix/cmm-2091-proper-fix
Open

Fix out-of-bounds crash when revealing a navigated Reader comment#25609
crazytonyli wants to merge 5 commits into
trunkfrom
bugfix/cmm-2091-proper-fix

Conversation

@crazytonyli

Copy link
Copy Markdown
Contributor

Note

The first commit formats the code. The second commit is the real change.

Description

Fixes https://linear.app/a8c/issue/CMM-2091.

#25608 fixes the same issue, but with a much safer approach, because it's changing the release branch. If this PR is merged, I'll discard the #25608 changes when merging the release branch into the trunk branch.

Testing instructions

In addition to verify the Linear issue is fixed, we also need to test the "reveal comment" code continues to work. You can follow the same steps in the Linear issue, except you need to add 100 comments to Author's post, instead of just 5.

@crazytonyli crazytonyli added this to the 27.0 milestone Jun 3, 2026
@crazytonyli crazytonyli requested a review from jkmassel June 3, 2026 09:49
@wpmobilebot

wpmobilebot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor
App Icon📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress
ConfigurationRelease-Alpha
Build Number32407
VersionPR #25609
Bundle IDorg.wordpress.alpha
Commite64d887
Installation URL1du9neslk8t3o
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

wpmobilebot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor
App Icon📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack
ConfigurationRelease-Alpha
Build Number32407
VersionPR #25609
Bundle IDcom.jetpack.alpha
Commite64d887
Installation URL1mdg18tbh3dbo
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

wpmobilebot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

🤖 Build Failure Analysis

This build has failures. Claude has analyzed them - check the build annotations for details.

The reveal animation captured the target comment's index path and reused it
across an async gap (up to ~1.8s). If a background comments sync purged rows in
that window, the deferred scrollToRow referenced a now out-of-bounds row and
crashed with an NSRangeException. Resolve the comment's current index path by ID
at scroll time instead, via a shared revealComment helper that bounds-checks
before scrolling, and route scrollToComment through it.
Navigating to a specific comment (e.g. from a notification) could leave the list
scrolled to the top instead of the target comment, intermittently. The page-1
comments sync purges every cached comment beyond the first page, so a later-page
target reached from a warm cache was deleted right after the reveal scrolled to
it, collapsing the list to the top. The reveal now waits for that destructive
initial sync to finish (re-paging to reload the target if it was purged) before
scrolling the comment into view, which makes the existing scroll reliable.
The reveal no longer relies on a per-cell render callback to re-scroll, so the
method is dead. Drop it along with its only call site in the cell configuration.
@crazytonyli crazytonyli force-pushed the bugfix/cmm-2091-proper-fix branch from c7462fa to e64d887 Compare June 4, 2026 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants