perf: remove unnecessary props from ReportActionContextMenu (isChronosReport, isPinnedChat, isUnreadChat)#89683
Open
roryabraham wants to merge 5 commits intomainfrom
Open
perf: remove unnecessary props from ReportActionContextMenu (isChronosReport, isPinnedChat, isUnreadChat)#89683roryabraham wants to merge 5 commits intomainfrom
roryabraham wants to merge 5 commits intomainfrom
Conversation
Remove the isChronosReport prop from BaseReportActionContextMenu, PopoverReportActionContextMenu, and the showContextMenu() public API. Derive it inside BaseReportActionContextMenu using the already-imported chatIncludesChronosWithID(originalReportID) — the same call that was already used in openOverflowMenu for the overflow submenu case. Remove isChronos from openOverflowMenu's showContextMenu call since it was always chatIncludesChronosWithID(originalReportID), identical to the new derived value. Remove isChronosReport from MiniReportActionContextMenu and the showPopover call in PureReportActionItem. Co-authored-by: Cursor <cursoragent@cursor.com>
Remove the isPinnedChat prop from BaseReportActionContextMenu, PopoverReportActionContextMenu, and the showContextMenu() public API. Derive it inside BaseReportActionContextMenu as !!report?.isPinned, using the report object already subscribed to via useOnyx. Remove isPinnedChat from OptionRowPressable's showContextMenu call. Co-authored-by: Cursor <cursoragent@cursor.com>
Remove the isUnreadChat prop from BaseReportActionContextMenu, PopoverReportActionContextMenu, and the showContextMenu() public API. Derive it inside BaseReportActionContextMenu by comparing report.lastReadTime against report.lastVisibleActionCreated, using the report already subscribed to via useOnyx. Remove isUnreadChat from OptionRowPressable's showContextMenu call. Co-authored-by: Cursor <cursoragent@cursor.com>
Remove the isThreadReportParentAction prop from BaseReportActionContextMenu, PopoverReportActionContextMenu, and the showContextMenu() public API. Derive it inside BaseReportActionContextMenu by checking whether the reportAction's childReportID matches the current reportID — this is true exactly when we're viewing the parent action from within its thread report. Remove isThreadReportParentAction from MiniReportActionContextMenu and the showPopover call in PureReportActionItem. Remove it from openOverflowMenu's showContextMenu call since the overflow context menu will re-derive it internally from the same condition. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
Author
61 tasks
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.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f259145ba6
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
The derived implementation (reportAction.childReportID === reportID)
was incorrect. ReportActionItemParentAction renders thread-header rows
with report={ancestorReport} (the parent report), so reportID is the
parent's ID, not the thread. childReportID points to the thread and
never equals the parent reportID, causing the flag to always be false
for thread-header rows — re-enabling Reply in thread and reversing the
Join/Leave thread options for that case.
Restore the prop so callers (PureReportActionItem, via the explicit
isThreadReportParentAction prop it already receives) continue to pass
the correct value through showContextMenu and the Popover state.
Co-authored-by: Cursor <cursoragent@cursor.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
Removes 3 props that were unnecessarily threaded through the entire ReportActionContextMenu prop chain and derives them internally inside
BaseReportActionContextMenuusing Onyx data it already subscribes to. This also removes unnecessary state variables andsetStatecalls which trigger additional re-renders inPopoverReportActionContextMenu.This is an extraction from #83784.
Fixed Issues
(partial) #83774
Tests
Offline tests
N/A — context menus are UI-only and don't make network requests.
QA Steps
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.mov
iOS: mWeb Safari
MacOS: Chrome / Safari
web.mov
web.mov