fix: can save vacation delegate that isn't associated with an account#83608
fix: can save vacation delegate that isn't associated with an account#83608truph01 wants to merge 19 commits intoExpensify:mainfrom
Conversation
|
@aimane-chnaif 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] |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bde8cfaf6c
ℹ️ 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".
src/pages/settings/Profile/CustomStatus/VacationDelegatePage.tsx
Outdated
Show resolved
Hide resolved
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppios.moviOS: mWeb SafariMacOS: Chrome / Safarivideo.mov |
src/pages/settings/Profile/CustomStatus/VacationDelegatePage.tsx
Outdated
Show resolved
Hide resolved
|
@aimane-chnaif I resolved your comment as well. |
|
job 7 failure seems not related |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 46d184e24a
ℹ️ 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".
|
|
||
| if (result.action === ModalActions.CONFIRM) { | ||
| await setVacationDelegate(currentUserLogin, delegateLogin, true, vacationDelegate?.delegate); | ||
| await setVacationDelegate(currentUserLogin, delegateLogin, true, vacationDelegateRef.current?.delegate); |
There was a problem hiding this comment.
Preserve original delegate when confirming warning
Using vacationDelegateRef.current?.delegate here loses the original delegate after a policy-diff warning flow: the first setVacationDelegate(..., false, ...) call already optimistically sets delegate to the new login and stores the original in previousDelegate, so the confirm call rewrites previousDelegate to the new login. If the confirm request then fails (e.g., transient API/network failure), StatusPage’s onCloseError rollback uses this overwritten previousDelegate, so the UI cannot restore the user’s actual prior delegate and can leave an unsaved delegate displayed.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
@MelvinBot To address this concern, I plan to update it to:
if (result.action === ModalActions.CONFIRM) {
const response = await setVacationDelegate(currentUserLogin, delegateLogin, true, vacationDelegateRef.current?.delegate);
if (!response?.jsonCode) {
clearVacationDelegateError(vacationDelegateRef.current?.previousDelegate);
}
Navigation.goBack(ROUTES.SETTINGS_STATUS);
return;
}
Does it look good?
|
I think this behavior is quite buggy and confusing user. Screen.Recording.2026-03-04.at.11.54.15.am.mov |
trjExpensify
left a comment
There was a problem hiding this comment.
|
@truph01 can you please address last 4 comments above? |
@aimane-chnaif Could you give me more details about the actual result and the expected result shown in your video? |
|
Hey, I noticed you changed If you want to automatically generate translations for other locales, an Expensify employee will have to:
Alternatively, if you are an external contributor, you can run the translation script locally with your own OpenAI API key. To learn more, try running: npx ts-node ./scripts/generateTranslations.ts --helpTypically, you'd want to translate only what you changed by running |
|
The proposed change doesn't fully address the concern. Here's why: The core problem: When the warning modal flow is triggered, the first So in the proposed code: const response = await setVacationDelegate(currentUserLogin, delegateLogin, true, vacationDelegateRef.current?.delegate);This still passes the new delegate as The The fix should be: Pass if (result.action === ModalActions.CONFIRM) {
await setVacationDelegate(currentUserLogin, delegateLogin, true, vacationDelegateRef.current?.previousDelegate);
Navigation.goBack(ROUTES.SETTINGS_STATUS);
return;
}This preserves the original delegate through the confirm flow — after the first optimistic update stores the original in The additional |
Code ReviewThe core fix — using 1.
|
|
@trjExpensify please confirm the behavior is correct The video has following cases in order:
video.mov |
@trjExpensify what do you think of this behavior? ios.mov |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ 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". |
|
@truph01 please pull main |
|
@codex review |
|
Please address @trjExpensify comment @truph01 |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ 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". |
If you meant to update copy, it's coming from backend |



Explanation of Change
Fixed Issues
$ #77509
PROPOSAL: #77509 (comment)
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 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
Screen.Recording.2026-02-27.at.01.49.15.mov
Android: mWeb Chrome
Screen.Recording.2026-02-27.at.01.57.04.mov
iOS: Native
Screen.Recording.2026-02-27.at.01.56.16.mov
iOS: mWeb Safari
Screen.Recording.2026-02-27.at.01.48.24.mov
MacOS: Chrome / Safari
Screen.Recording.2026-02-27.at.01.47.38.mov