[HOLD] decompose ReportActionsList#87506
Draft
adhorodyski wants to merge 35 commits intoExpensify:mainfrom
Draft
[HOLD] decompose ReportActionsList#87506adhorodyski wants to merge 35 commits intoExpensify:mainfrom
adhorodyski wants to merge 35 commits intoExpensify:mainfrom
Conversation
…eLoadReportActions
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…er branches Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…bled Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…rdless of prior marker
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Explanation of Change
PR 3 of the ReportActionsList decomposition series (#84895).
Decomposes the monolithic
ReportActionsListinto a clean, hook-driven pipeline and completes the InvertedFlashList migration using built-in APIs rather than workarounds. Net: ~−600 lines across the list surface, one new hack removed from scope, dozens of pre-migration hacks gone.The pipeline
ReportActionsList.tsxis now a thin orchestrator that composes seven focused hooks, each with a single responsibility:useReportActionsPaginationuseTransactionThreaduseLoadReportActionsloadOlderChats/loadNewerChatsimperative API for the listuseReportActionsVisibilityuseUnreadMarkerunreadMarkerTimeuseMarkAsReaduseReportActionsScrollPlus two extracted presentation components:
ReportActionsListHeader,ShowPreviousMessagesButton.Hacks removed vs. main
StaticReportActionsPreviewhidden-renderinitialScrollIndexbroken on inverted lists (RN #56237, #54409, #41163) — mount items hidden,scrollToEnd, revealmaintainVisibleContentPosition={{ startRenderingFromBottom: true }}— a first-class FlashList API that mounts at the last index and renders items from there firstscrollToEndon mountLIST_SCROLLING_DEBOUNCE_TIMEtimeronMomentumScrollEnd)shouldHideContent,shouldDisableVisibleContentPosition,flex0style conditional, customshowsVerticalScrollIndicatortoggleshouldEnableAutoScrollToTopThreshold={!hasNewerActions}getInitialNumReportActionsToRender+ 3-branchinitialNumToRenderlogiconStartReachedspam" (FlatListmaxToRenderPerBatchera)maxToRenderPerBatch; preview-slice sizing gonelistOldIDrandom int + regenerate-on-link-changekey={reportID}+initialScrollKey={linkedReportActionID}— FlashList's hook anchors via data slicing + MVCP, no forced remount${reportID}-${linkedReportActionID}concatenated keyhasNewestReportActionRef+sortedVisibleReportActionsRef+ render-time writesuseEffectEvent— stable callback identity, native latest-state access, zero refsprevUnreadMarkerReportActionIDref + render-time read/writeprevHandleReportChangeMarkAsRead !== prev.currentidentity guards inuseMarkAsReaduseCallback-wrapped).isMarkedAsReadshort-circuit is the real safety; guards removed as noiseisLoadingInitialReportActions = falsedead constantscrollToBottomimperative on mountHacks introduced (scoped, unavoidable)
InvertedFlashList/useInvertedWheelHandler.web.ts— FlashList uses its ownRecyclerViewon web and bypasses react-native-web'sinvertedWheelEventHandlerpatch (which RN-Web built intoVirtualizedListfor exactly this reason). Without it, wheel scroll feels reversed on every inverted chat on web. The hook ports the RN-Web patch into ourInvertedFlashListwrapper. Applicable to all inverted lists in the app, not justReportActionsList. Ideally lands upstream; this is our local compensation until then.New built-in APIs in play
Instead of the workarounds:
useEffectEventreplaces two latest-value refs inuseReportActionsScroll.usePreviousreplaces manual prev-render refs wherever the pattern fits.Dead code deleted
ReportActionsView.tsx(old monolith)StaticReportActionsPreview/(hide-render hack)getReportActionsListInitialNumToRender.ts+ its testtests/ui/ReportActionsViewTest.tsx+tests/perf-test/ReportActionsList.perf-test.tsx(replaced by the new decomposition; coverage moved to hook-level unit tests)Behavior changes (to QA)
!prevUnreadMarkerReportActionID. Rule is now consistent: a marker never lands on the current user's own new or just-confirmed message. Previously, once a marker existed, it could jump onto the user's own subsequent message in narrow scenarios (prior marker read, only own unread remains). Documented inline inshouldDisplayNewMarkerOnReportAction.ts.startRenderingFromBottomfor transaction thread / money request reports. Visual result identical to the hide-render-reveal pattern, but without the flicker risk and without a reveal timer.Risk
Open app — branch (
decompose/report-actions-list) vsexfy/mainMeasured with React DevTools Profiler, 5 trials each.
Summary
Improved
Regressed
Fixed Issues
$ #88320
Tests
Offline tests
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionmainbranch was merged into this PR after a review, I tested again and verified the outcome was still expectedScreenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari