Repository navigation
Fix parent message not editable from a nested thread - #97418
Conversation
|
@hoangzinh 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] |
On narrow layouts the shared main composer persisted the edit draft using the
visible report's ID. For a nested thread's top ancestor the action is a
grandparent, so getOriginalReportID could not rescue it and fell through to the
viewed thread's own ID, and saveReportActionDraft's Onyx.setCollection replaced
the whole drafts collection, wiping the correct bucket. The read path then
resolved a null editingReportAction, so both save and cancel were inert.
Both edit-save sites now target editingReportID (the owning report, already
resolved by useActiveDraftReportAction) and pass the full editingReportAction
instead of a stripped {reportActionID} cast, which also defeated the
childReportID recovery for first-level threads.
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
| } | ||
|
|
||
| saveReportActionDraft(reportID, {reportActionID: editingReportActionID} as OnyxTypes.ReportAction, newCommentConverted); | ||
| saveReportActionDraft(editingReportID ?? reportID, editingReportAction, newCommentConverted); |
There was a problem hiding this comment.
By passing the whole reportAction object, it potentially causes a regression issue on this line
Line 10664 in 1fcd702
There was a problem hiding this comment.
hmm.. do you think so? it can't fire here though. isThreadReportParentAction compares childReportID against the reportID we pass, and we now pass editingReportID, which is always the report that contains the action (ancestor, visible, transaction thread). childReportID is a thread spawned from the action, so it never equals the report the action lives in and the condition stays false either way.
checked it rather than assumed: with the owning report, the full and stripped objects return the same value. they only differ if you pass the child thread, which is what the old code did, where the full object recovers the parent and the stripped one falls through to the thread. also added a test for the direct-parent case (editing the parent from inside its own thread).
…de its own thread)
|
@hoangzinh kindly bump |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-08-03.at.17.27.36.movAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / SafariScreen.Recording.2026-08-03.at.17.21.11.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. |
|
🚧 blimpich 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/blimpich in version: 9.4.49-0 🚀
|
|
🤖 Docs review: no help-site changes required. This PR is a bug fix that restores the intended behavior of editing a parent/ancestor message from a nested thread on narrow layouts. It changes internal draft-resolution logic ( The existing help article already documents editing messages and replying in threads accurately, and the corrected behavior matches what's documented:
Since the fix makes the app match already-documented behavior, no draft docs PR was created. @mukhrr, no help site PR was needed here — let me know if you'd still like the Edit/Delete Messages or thread documentation expanded (e.g. to explicitly call out editing an ancestor message from within a nested thread), and I can draft one. |
|
🚀 Deployed to production by https://github.com/arosiclair in version: 9.4.49-3 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
On narrow layouts editing happens in the shared main composer, and it saved the edit draft under the report you're currently viewing instead of the report that owns the message.
That only breaks two hops deep. In a nested thread the top ancestor is a grandparent message, so
getOriginalReportID()can't rescue it (it only handles a direct parent, viachildReportID === reportID) and falls back to the viewed thread's ID. SincesaveReportActionDraft()writes withOnyx.setCollection, which replaces the whole drafts collection, the first keystroke moved the draft to the wrong bucket and deleted the correct one.useActiveDraftReportActionthen looks for the action in the nested thread's actions, doesn't find it, and returnseditingReportAction: null. BothpublishDraft()anddeleteDraft()early-return on null, which is why save and cancel did nothing. Wide layouts were fine because the inline editor already saves with the row's own report ID.Fix: both save sites now use
editingReportID ?? reportID(the owning report, already resolved byuseActiveDraftReportAction) and pass the fulleditingReportActioninstead of a stripped{reportActionID}cast.Fixed Issues
$ #92077
PROPOSAL: #92077 (comment)
Tests
Offline tests
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, 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.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_app.mp4
Android: mWeb Chrome
android_web.mp4
iOS: Native
ios_app.mp4
iOS: mWeb Safari
ios.web.mp4
MacOS: Chrome / Safari
92077-web.mp4