perf: remove PureReportActionItem and use stable report#51
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Explanation of Change
1.
stableReportSelector(src/selectors/stableReportSelector.ts)A
useOnyxselector that strips heartbeat-style fields from aReport(lastMessageText,lastVisibleActionCreated,lastReadTime,lastReadSequenceNumber,lastMentionedTime,lastVisibleActionLastModified,lastMessageHtml,lastActorAccountID,lastActionType). Subscribed components stop re-rendering on heartbeat-only Onyx pushes.Applied at 5 production
useOnyxsubscription sites:MoneyRequestReportActionsList— expense report scrollReportActionsList— chat scrollReportActionItem(originalReportsubscription) — runs per visible actionChatListItem— search results listDuplicateTransactionItem— duplicate review list2.
ReportActionIndexContext(src/pages/inbox/report/ReportActionIndexContext.tsx)A tiny React context that carries the action item's position index from the list renderer to the rare consumers that read it (
ReportActionItemMessageEditfor scroll-to-index during edit mode). Replaces prop drilling — a new message arriving no longer cascades index re-renders through every item.3. Whisper-handler fix (
MentionWhisperContent,ReportMentionWhisperContent,ConfirmWhisperContent)resolveActionableMentionWhisper/resolveActionableReportMentionWhisper/resolveActionableMentionConfirmWhisperbuild a failure-revert payload fromreport.lastMessageText/lastVisibleActionCreated/lastActorAccountID. Those are exactly the heartbeat fields the selector strips. Without a fix, an API failure would merge{lastMessageText: undefined, …}into Onyx and clobber the user's LHN preview.Fix: each whisper component adds one
useOnyxsubscription without a selector to fetch the full report, and passes that wide value into the resolve action.ReportMentionWhisperContentandConfirmWhisperContentalso swap theiractionReport: OnyxEntry<Report>prop foractionReportID: string | undefined(the prop was only used for its ID anyway).MentionWhisperContentkeeps its existing prop shape — minimal diff, lowest regression surface. Only change is one addeduseOnyxline and three call-site swaps fromactionReporttoactionReportFull.Fixed Issues
$
PROPOSAL:
Tests
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand 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