Skip to content

Backport missing ViewState guards for state and padding updates - #98869

Merged
mountiny merged 1 commit into
Expensify:mainfrom
KJ21-ENG:KJ21-ENG/93833-viewstate-state-padding-follow-up
Aug 21, 2026
Merged

mountiny merged 1 commit into
Expensify:mainfrom
KJ21-ENG:KJ21-ENG/93833-viewstate-state-padding-follow-up

Conversation

@KJ21-ENG

@KJ21-ENG KJ21-ENG commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Extends the existing React Native 0.86 patch for missing Android Fabric
ViewState values. The patch already guards updateOverflowInset; this follow-up
backports React Native commit 0e86a043 so updatePadding and updateState also
use getNullableViewState(), soft-log a missing state, and return instead of
throwing RetryableMountingLayerException from a non-retryable
IntBufferBatchMountItem.

This addresses the production 9.4.46-10 fatal recurrence whose stack is
getViewState -> updateState -> IntBufferBatchMountItem. Search/FlashList
clipping, sendAccessibilityEvent, and setJSResponder are intentionally
unchanged.

Fixed Issues

$ #93833
PROPOSAL: #93833 (comment)

Tests

The production crash is nondeterministic, so these steps provide regression
smoke coverage rather than deterministic proof of the fix.

  1. Sign in to the Android HybridApp with an account containing many reports and expenses.
  2. Open Search and open reports from the search results.
  3. Navigate repeatedly between Search and report views.
  4. Scroll quickly through long lists and repeatedly expand and collapse grouped report rows.
  5. Verify the app remains responsive and does not crash.

Final effectiveness will be confirmed by monitoring APP-3E3 after deployment.

  • Verify that no errors appear in the JS console — N/A: this changes Kotlin
    inside React Native and introduces no JS/TS execution path.

Offline tests

N/A. The guard runs in React Native's Android Fabric mounting layer and does not
depend on network, Onyx, account, or permission state.

QA Steps

Same as Tests. Treat this as regression smoke coverage only; monitor APP-3E3
after deployment to confirm effectiveness.

  • Verify that no errors appear in the JS console — N/A: Android native-only change.

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios. N/A: the missing native ViewState is the failure path handled by the guard; there is no input or user-facing error state.
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior. N/A: network state cannot reach this Fabric guard, and no offline manual run is claimed.
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions. N/A: no account or API behavior changes, and no high-traffic manual run is claimed.
  • I included screenshots or videos for tests on all platforms. N/A: there is no visual change.
  • I ran the tests on all platforms & verified they passed on. N/A: this is an Android-only React Native Kotlin patch; cross-platform manual testing is not claimed.
    • Android: Native. N/A: the nondeterministic smoke flow was not performed; patch application and remote validation are the repeatable proof claimed by this draft.
    • Android: mWeb Chrome. N/A.
    • iOS: Native. N/A.
    • iOS: mWeb Safari. N/A.
    • MacOS: Chrome / Safari. N/A.
  • I verified there are no console errors. N/A: no JS/TS path changed, and no manual console run is claimed.
  • I followed proper code patterns
    • I verified that comments were added to code that is not self explanatory. N/A: no explanatory code comment is needed for the exact upstream guard.
    • I verified that any new or modified comments were clear, correct English, and explained why. N/A: no code comments changed.
    • I verified any copy/text added to the app is grammatically correct. N/A: no product copy changed; diagnostic strings match upstream.
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers. N/A: this is the established upstream missing-ViewState guard pattern.
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes. N/A: no App component changed; patch integrity covers the React Native backport.
  • If a new CSS style is added I verified that. N/A: no styles changed.
    • A similar style doesn't already exist. N/A.
    • The style can't be created with an existing StyleUtils function. N/A.
  • If new assets were added or existing ones were modified, I verified that. N/A: no assets changed.
    • The assets are optimized and compressed. N/A.
    • The assets load correctly across all supported platforms. N/A.
  • If the PR modifies code that runs when editing or sending messages, I tested supported markdown. N/A: message editing/sending is unchanged.
  • If the PR modifies a generic component, I tested its usages. N/A: no App component changed.
  • If the PR modifies a component related to Storybook stories, I verified those stories. N/A: no component changed.
  • If the PR modifies a component or page accessed by deeplink, I verified logged-in and logged-out behavior. N/A: no page or route changed.
  • If the PR modifies UI or form input styles, I verified alignment and requested Design review. N/A: no UI or form styles changed.
    • I verified all form inputs are aligned. N/A.
    • I added the Design label or tagged Expensify/design. N/A.
  • I added unit tests for any new feature or bug fix. N/A: App has no JS/TS test seam for this Kotlin React Native mount-layer patch; clean patch application and remote CI validate the backport.
  • If main was merged after review, I tested again. N/A: the branch starts from current upstream/main and no later merge has occurred.

Screenshots/Videos

Android: Native

N/A: no visual change.

Android: mWeb Chrome

N/A: Android native-only change.

iOS: Native

N/A: Android native-only change.

iOS: mWeb Safari

N/A: Android native-only change.

MacOS: Chrome / Safari

N/A: Android native-only change.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ This PR is possibly changing native code and/or updating libraries, it may cause problems with HybridApp. Please check if any patch updates are required in the HybridApp repo and run an AdHoc build to verify that HybridApp will not break. Ask Contributor Plus for help if you are not sure how to handle this. ⚠️

@KJ21-ENG
KJ21-ENG marked this pull request as ready for review August 18, 2026 13:47
@KJ21-ENG
KJ21-ENG requested a review from a team as a code owner August 18, 2026 13:47
@melvin-bot
melvin-bot Bot requested review from eVoloshchak and removed request for a team August 18, 2026 13:48
@melvin-bot

melvin-bot Bot commented Aug 18, 2026

Copy link
Copy Markdown

@eVoloshchak Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@eVoloshchak

Copy link
Copy Markdown
Contributor
screen-20260819-175449-1787154841427.mp4

@KJ21-ENG, this doesn't look right, the views are clipped much more than in main, could you double check it on your end please?

@KJ21-ENG

Copy link
Copy Markdown
Contributor Author

Strange, checking it.

@KJ21-ENG

Copy link
Copy Markdown
Contributor Author

I rechecked this against current main and reproduced the same full-list blanking there, so it is not introduced by this PR. The exact PR-head run also produced no updateState, updatePadding, missing-ViewState, or RetryableMountingLayerException event while the visual symptom occurred.

Screen.Recording.2026-08-20.at.3.27.49.AM.mov

@KJ21-ENG

Copy link
Copy Markdown
Contributor Author

It seems to be there for a long time. It's quite weird that it wasn't noticed till now. Here is the recording of one of the older versions.

Record_2026-08-20-13-43-05.mp4

@KJ21-ENG

KJ21-ENG commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor Author

The root cause is the existing Android FlashList render window used by Inbox and Reports > Expenses. Both lists use drawDistance={250}; FlashList turns that into only about 350 px of directional pre-render buffer on the tested 727 px viewport, while the captured fast flings moved 558–917 px in 114–178 ms. The viewport therefore outruns the rendered cells and briefly reaches zero viewable items, producing the blank list until FlashList catches up. This is the known tradeoff from PRs #82378 and #83277, which reduced the prior 1000 px buffer for performance, and #83277 explicitly noted that fast scrolling could show blank spaces. An Android-only drawDistance={1000} candidate kept the list continuously rendered through repeated Inbox and Reports > Expenses tests.

We can handle this in a separate issue, as I don't think that it should be handled in this PR.

Here is the test branch:- https://github.com/KJ21-ENG/App/tree/KJ21-ENG/android-flashlist-fast-scroll-blanking.

cc: @eVoloshchak @mountiny

POW :-

Screen.Recording.2026-08-20.at.1.10.35.PM.compressed.mp4

@mountiny

Copy link
Copy Markdown
Contributor

@eVoloshchak if its unrelated to these changes, lets continue with the review

@KJ21-ENG

Copy link
Copy Markdown
Contributor Author

@eVoloshchak if its unrelated to these changes, lets continue with the review

@mountiny meanwhile, should we create a new issue for this particular bug and start working on it? You can refer to #98869 (comment) for a detailed explanation. Thanks!

@mountiny

Copy link
Copy Markdown
Contributor

I asked QA for retest of that

@m-natarajan

Copy link
Copy Markdown

Scrolling issue repro in Pixel 4/13 v9.4.57-3

az_recorder_20260820_201835.mp4

@KJ21-ENG

Copy link
Copy Markdown
Contributor Author

Scrolling issue repro in Pixel 4/13 v9.4.57-3

az_recorder_20260820_201835.mp4

cc: @mountiny

@mountiny

Copy link
Copy Markdown
Contributor

Asking about something internally

@eVoloshchak

eVoloshchak commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
screen-20260821-142315-1787314975681.mp4

@eVoloshchak eVoloshchak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@melvin-bot
melvin-bot Bot requested a review from mountiny August 21, 2026 12:24
@mountiny

Copy link
Copy Markdown
Contributor

@MelvinBot can you create an issue for this #98869 (comment) and assign @mountiny and @chrispader

We will migrate to LegendList so we dont need to add more work for this in FlashList, but just to make sure the issue is fixed when LegendList is used

@mountiny mountiny left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding these

@mountiny
mountiny merged commit 87f89a0 into Expensify:main Aug 21, 2026
34 of 36 checks passed
@MelvinBot

Copy link
Copy Markdown
Contributor

Created the follow-up issue: #99202 — assigned to mountiny and chrispader.

I framed it around the LegendList migration: it captures the FlashList fast-scroll blanking on Inbox and Reports > Expenses, but the goal is to verify it's fixed once LegendList is in place rather than add more drawDistance work in FlashList.


view run

@github-actions

Copy link
Copy Markdown
Contributor

🚧 mountiny has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify OSBotify mentioned this pull request Aug 22, 2026
61 tasks done
@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/mountiny in version: 9.4.59-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/AndrewGable in version: 9.4.59-5 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants