[No-QA] perf: video player render loop#88314
Conversation
|
@hungvu193 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] |
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
Reviewer Checklist
Screenshots/VideosNativeScreen.Recording.2026-04-21.at.14.05.55.movMacOS: Chrome / SafariScreen.Recording.2026-04-21.at.13.51.13.mov |
|
@TaduJR Can you check if this bug is related to your current changes? 🤔 Screen.Recording.2026-04-21.at.13.57.06.mov |
…layer-render-loop
@hungvu193 Not able to reproduce after merge main. iOS-Native.mp4 |
|
Oh I'm also not able to reproduce 😄 |
blimpich
left a comment
There was a problem hiding this comment.
Good PR! Thanks for working on this!
|
🚀 Deployed to staging by https://github.com/blimpich in version: 9.3.62-13 🚀
Bundle Size Analysis (Sentry): |
|
No help site changes required. This PR is a performance optimization for the video player component (reducing unnecessary re-renders). The changes are purely internal — no user-facing features, settings, labels, or workflows were added or modified. Existing help site articles don't document video player internals. |
|
🚀 Deployed to staging by https://github.com/blimpich in version: 9.3.63-1 🚀
Bundle Size Analysis (Sentry): |
|
🚀 Deployed to staging by https://github.com/blimpich in version: 9.3.64-0 🚀
Bundle Size Analysis (Sentry): |
|
@TaduJR @hungvu193 @blimpich Title says no QA, have steps as tests, Is the fixed issue needs to be QAed? |
Explanation of Change
BaseVideoPlayerre-renders ~10×/s forever on every mounted player, even paused/never-played thumbnails. Two independent causes:timeUpdateEventIntervalruns an unconditionalsetInterval, anduseEventhas no equality check — every tick re-renders every consumer regardless of play state.fakeReportIDis a getter that increments each access; calling it inline on every render changed thereportIDprop and invalidated the share-effect's deps.Changes
BaseVideoPlayer.tsx: defaulttimeUpdateEventInterval = 0, subscribe toplayingChangeviauseEventforisPlayingstate, toggle the interval to0.1 / 0inside the existingplayingChangelistener.VideoPlayer/index.tsxandindex.native.tsx: freezefakeReportIDper instance withuseState(() => …).Paused players: 200+ renders → 2–3. Play/pause icon now flips correctly on pause (latent bug previously masked by the cascade).
Fixed Issues
$ #87921
PROPOSAL: #87921 (comment)
Tests
Offline tests
Same as tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari