Repository navigation
Keep unsaved message edit when closing the Concierge side panel - #103950
Conversation
Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>
|
The failing Analysis: Evidence: This PR only changes Fix: [No QA] Fix ESLint and typecheck failures on main removes the duplicate line. After it merges, merge
|
|
@codex review |
|
@MelvinBot review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ 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". |
|
Fixed the failing checks: I merged Both failures came from
|
|
🤖 Web test steps verification results: ✅ pass The Concierge side panel docks on the right in a wide window, and closing it (or reopening and closing it again) keeps an unsaved inline edit. Switching reports still discards the draft, which matches existing behavior.
|
|
⏱️ Ran out of time before I could finish. This usually means the task was too complex or I got stuck exploring. Please try again with a more specific request or post in #melvinbot-ai. |
Unsaved edit in the side panel now survives closing the panelThis early return also skips the cleanup when the side panel closes, so the side panel's own edit draft is kept and the editor reopens with the unsaved text. On every other report, leaving and coming back dismisses the edit.
Expected: The edit is dismissed and |
|
🤖 Web test steps verification results: ❌ fail I couldn't run the regression checks: the browser automation couldn't put a message into edit mode (hover, plain click, and the Up arrow shortcut all failed), so no step reached the PR's code path and this is not an App failure. From the code, the likely regression is that the side panel now never clears drafts (
|
Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>
|
Good catch, The side panel now clears only its own report's edit draft when it opens, closes, or switches reports (
The unit test now covers both cases. The test, ESLint, and I couldn't check this in the browser. The test session showed a blank page after its onboarding setup failed, so no steps ran. Please run your four steps by hand to confirm. view run · no recording available |
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.
|
|
@MelvinBot add QA Steps, same as OP in the linked issue |
|
Added the QA Steps to the PR description. They copy the precondition, steps and expected result from [$175] Web - Chat - Unsaved inline edit is discarded when closing the Concierge side panel.
The JS console check is still there. I left the Tests section as it was. |
|
@MelvinBot mark this PR ready for review |
|
🤖 Done. This PR is now ready for review. The Tests and QA Steps sections still contain the TODO placeholders. Please fill them in before review. You can reuse the steps from the web test run above. |
|
@mkhutornyi 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] |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppios.mp4iOS: mWeb Safarimsafari.mp4MacOS: Chrome / Safariweb.mov |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4adede0779
ℹ️ 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".
| return () => { | ||
| clearReportActionDrafts(reportID); | ||
| }; |
There was a problem hiding this comment.
Clear drafts from their actual owning report bucket
When the side panel displays a thread and the user edits its surfaced parent action, saveReportActionDraft() stores that draft under the parent report ID rather than the visible thread ID. On close, this cleanup deletes only the thread's bucket, so the parent-action draft survives and reopens the editor when the thread is revisited. Resolve and clear the draft-owning report ID instead of assuming it always equals reportID.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Thanks, but I couldn't find a case where this is visible.
Closing with X / back / Esc switches the panel back to the Concierge chat while it slides out, which clears the parent draft.
The only close that skips that is navigating away on narrow screens, and every screen that could show the leftover draft clears it when it opens (the Concierge chat in the panel, or any report in the main view).
So the editor never reopens.
| function useClearReportActionDraftsOnReportChange(reportID: string | undefined) { | ||
| const isInSidePanel = useIsInSidePanel(); | ||
|
|
||
| useEffect(() => { | ||
| // The side panel report renders next to the central report, so opening or closing it only discards the side panel report's own edit draft | ||
| if (isInSidePanel) { | ||
| clearReportActionDrafts(reportID); | ||
|
|
||
| return () => { | ||
| clearReportActionDrafts(reportID); | ||
| }; | ||
| } | ||
|
|
||
| clearAllReportActionDrafts(); | ||
|
|
||
| return () => { | ||
| clearAllReportActionDrafts(); | ||
| }; | ||
| }, [reportID]); | ||
| }, [reportID, isInSidePanel]); |
There was a problem hiding this comment.
@MelvinBot we should not change mobile web behavior on production.
Suggested change:
function useClearReportActionDraftsOnReportChange(reportID: string | undefined) {
const isInSidePanel = useIsInSidePanel();
const {isExtraLargeScreenWidth} = useResponsiveLayout();
// Only the docked panel sits beside a usable chat, the narrow modal covers it like a new page on native
const isDockedSidePanel = isInSidePanel && isExtraLargeScreenWidth;
useEffect(() => {
if (isDockedSidePanel) {
clearReportActionDrafts(reportID);
return () => {
clearReportActionDrafts(reportID);
};
}
clearAllReportActionDrafts();
return () => {
clearAllReportActionDrafts();
};
}, [reportID, isDockedSidePanel]);
}
Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>
|
@mkhutornyi 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] |
|
Done. I applied your suggestion in 9f0e947. Only the docked side panel (
The unit tests, ESLint, cspell, the React Compiler check and |
|
We did not find an internal engineer to review this PR, trying to assign a random engineer to #103036 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
|
🚧 Gonals 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! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/Gonals in version: 9.5.15-1 🚀
|
|
No help site update is needed. This bug fix keeps an unsaved message edit when you open or close the Concierge side panel, which is what users already expect, and it doesn't make any help article sentence incorrect. |
|
🚀 Deployed to production by https://github.com/grgia in version: 9.5.15-3 🚀
Bundle Size Analysis (Sentry): |














Explanation of Change
On wide web, the Concierge side panel renders a second
ReportScreennext to the central report. Both runuseClearReportActionDraftsOnReportChange, which callsclearAllReportActionDrafts()on mount and unmount. That function wipes the wholeREPORT_ACTIONS_DRAFTScollection. So opening or closing the side panel discarded an unsaved edit in the central chat, and the editor closed.This PR skips the clearing when the hook runs inside the side panel (
useIsInSidePanel()). The central report andSearchMoneyRequestReportPagestill discard edit drafts when you leave or switch reports. A unit test covers both cases.AI checks run locally: the new unit test and
SearchMoneyRequestReportPageTestpass, and ESLint, cspell and the React Compiler check pass on the changed files.npm run typecheckfails only ontests/actions/PolicyTest.ts(782,17), which this PR doesn't touch. A browser check couldn't run because the test session failed to sign in.Fixed Issues
$ #103036
PROPOSAL: #103036 (comment)
Tests
// TODO: The human co-author must fill out the tests you ran before marking this PR as "ready for review"
// Please describe what tests you performed that validates your changed worked.
Offline tests
QA Steps
Precondition: Web, with the browser window wider than 1300px. At 1300px or narrower the side panel is a modal, so you can't use the central chat while it's open.
hello.hello, open the context menu and choose Edit comment.hello world, and don't save.hello world.PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)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: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari