refactor: PureReportActionItem, move composer focus and delete-draft logic#89485
Conversation
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.
|
864164d to
672e129
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
|
@shubham1206agra 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] |
672e129 to
2c14e0c
Compare
|
@LukasMod Please fix conflicts here |
…ctionitem-edit-mode
|
@shubham1206agra conflicts resolved 👍 |
Screen.Recording.2026-05-08.at.9.32.40.PM.mov@LukasMod There's a weird bug on iOS. Can you check if you can repro this at all? |
|
@shubham1206agra Do you mean edit composer flickering? I have similar on main branch (simulator, video attached) and in prod app on real device (but device is faster so it feels better). Also I guess it is much better when use device keyboard in simulator. If you mean this white screen at the end - can't repro right now main branch: this branch: |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-05-08.at.9.55.14.PM.movAndroid: mWeb ChromeScreen.Recording.2026-05-08.at.9.21.10.PM.moviOS: HybridAppScreen.Recording.2026-05-08.at.9.34.48.PM.moviOS: mWeb SafariScreen.Recording.2026-05-08.at.9.06.47.PM.movMacOS: Chrome / SafariScreen.Recording.2026-05-08.at.8.59.50.PM.mov |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 @cristipaval has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/cristipaval in version: 9.3.70-0 🚀
Bundle Size Analysis (Sentry): |
|
🚀 Deployed to staging by https://github.com/cristipaval in version: 9.3.72-0 🚀
Bundle Size Analysis (Sentry): |
|
No help site changes are required for this PR. This is a pure internal refactoring that moves two edit-mode |
|
🚀 Deployed to production by https://github.com/lakchote in version: 9.3.72-1 🚀
|
Explanation of Change
Move two edit-mode-only useEffects out of
PureReportActionItemand intoReportActionItemMessageEdit(the leaf that only mounts when a draft is open):useEffectusedusePrevious(draftMessage)to detect the no-draft to draft transition. The leaf only mounts whendraftMessage !== undefined, so a plain mount-onlyeffect inside it is equivalent.
composerTextInputRef, the focus effect, the prop chain throughChatMessageContent, and the leaf's externally-passed ref prop all go away.useEffectrandeleteReportActionDraftwhendraftMessage !== undefined && isDeletedAction(action). Moved into the leaf with the sameisDeletedActionpredicate; thedraftMessageguard becomes structural.deleteReportActionDraftno longer needs to be drilled as a prop or injected byReportActionItem.tsx; the leaf imports it directly.For the dominant non-edit row this removes one useRef, two useEffects, one usePrevious call, and one prop chain. No behavior change.
Fixed Issues
$ #89780
PROPOSAL:
Tests
Test 1: Composer focuses when entering edit mode
Test 2: Edit save still works end-to-end
Test 3: Draft cleanup when the action is deleted while editing
Two windows or two browser sessions for the same account work, or two cooperating users in the same workspace chat.
Offline tests
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.native.mov
Android: mWeb Chrome
android.web.mov
iOS: Native
ios.native.mov
iOS: mWeb Safari
ios.web.mov
MacOS: Chrome / Safari
web.mov