fix: refactor modals part 3 (VacationDelegatePage, ContactMethodDetailsPage, WalletPage, VisibilityPage)#79553
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.
|
|
@ZhenjaHorbach 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] |
| const hideModal = useCallback(() => { | ||
| setShowConfirmModal(false); | ||
| }, []); | ||
| const showPublicVisibilityModal = async () => { |
There was a problem hiding this comment.
❌ CONSISTENCY-1 (docs)
The changeVisibility callback has showConfirmModal in its dependency array, but this function is now the hook function itself, not a boolean state variable. Since showConfirmModal is a stable function from the hook, it should not be in the dependency array, or this line needs to be updated.
Looking at the old code, showConfirmModal was a boolean state that determined whether to navigate back. The new refactored code should remove showConfirmModal from the dependency array since it's now a stable function reference.
Suggested fix:
const changeVisibility = useCallback(
(newVisibility: RoomVisibility) => {
if (!report) {
return;
}
updateRoomVisibility(report.reportID, report.visibility, newVisibility);
goBack();
},
[report, goBack],
);There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 85b295fa8c
ℹ️ 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 (response.jsonCode === CONST.JSON_CODE.POLICY_DIFF_WARNING) { | ||
| setIsWarningModalVisible(true); | ||
| const result = await showVacationDelegateWarningModal(); | ||
| if (result.action === ModalActions.CONFIRM) { | ||
| setVacationDelegate(currentUserLogin ?? '', newVacationDelegate, true, vacationDelegate?.delegate).then(() => Navigation.goBack(ROUTES.SETTINGS_STATUS)); | ||
| } else { |
There was a problem hiding this comment.
Use selected login when confirming policy warning
When POLICY_DIFF_WARNING is returned, showVacationDelegateWarningModal() is awaited before setNewVacationDelegate(option?.login) runs, and the confirm branch uses newVacationDelegate. This means the modal text and the follow‑up setVacationDelegate call use the previous selection (or an empty string) rather than the option the user just picked. In practice, selecting a new delegate that triggers the warning will show the wrong name and, on confirm, re-submit the old delegate instead of the intended one. Consider passing option?.login into the modal/confirm path (or updating state before showing the modal).
Useful? React with 👍 / 👎.
heyjennahay
left a comment
There was a problem hiding this comment.
Product review not required
| } | ||
| goBack(); | ||
| }, | ||
| [report, showConfirmModal, goBack], |
There was a problem hiding this comment.
React compiler issue
Could you recheck this PR, please?
There was a problem hiding this comment.
I just removed useCallback.
Reviewer Checklist
Screenshots/VideosAndroid: HybridApp2026-02-06.17.21.14.mov2026-02-06.17.21.51.mov2026-02-06.17.23.28.mov2026-02-06.17.24.07.mov2026-02-06.17.26.02.movAndroid: mWeb Chrome2026-02-06.17.51.20.mov2026-02-06.17.51.49.mov2026-02-06.17.52.23.mov2026-02-06.17.52.43.mov2026-02-06.17.54.07.moviOS: HybridApp2026-02-06.17.21.14.mov2026-02-06.17.21.51.mov2026-02-06.17.23.28.mov2026-02-06.17.24.07.mov2026-02-06.17.26.02.moviOS: mWeb Safari2026-02-06.17.51.20.mov2026-02-06.17.51.49.mov2026-02-06.17.52.23.mov2026-02-06.17.52.43.mov2026-02-06.17.54.07.movMacOS: Chrome / Safari2026-02-06.16.51.10.mov2026-02-06.16.52.20.mov2026-02-06.17.05.56.mov2026-02-06.17.06.33.mov |
|
I just merged main & fixed conflicts |
|
When I navigate directly to On staging everything is good 2026-02-06.17.14.11.mov |
|
But overall, the changes look good! @truph01 |
|
@ZhenjaHorbach I fixed the bug in |
|
Now is good And looks like lint issues are not ours |
| useEffect(() => { | ||
| // If the user was previously offline, skip debouncing showing the loader | ||
| if (!network.isOffline) { | ||
| // eslint-disable-next-line react-hooks/set-state-in-effect |
There was a problem hiding this comment.
Why do we need this line?
There was a problem hiding this comment.
Calling updateShouldShowLoadingSpinner(); triggers an ESLint error. Although this line was not added in this PR, I added an ESLint disable comment to ensure the checks pass.
There was a problem hiding this comment.
Yeah
These aren't our changes
But in that case, let's add a comment explaining why we added this line, or leave it as is
|
I see we've got conflicts in the |
|
@truph01 |
|
@ZhenjaHorbach I just fix conflicts |
|
Sorry @truph01, you've got conflicts again. The |
|
@truph01 |
|
@ZhenjaHorbach All good now! |
|
|
||
| const [vacationDelegate] = useOnyx(ONYXKEYS.NVP_PRIVATE_VACATION_DELEGATE, {canBeMissing: true}); | ||
|
|
||
| const showWarningModal = useCallback( |
There was a problem hiding this comment.
NAB this component compiles with React Compiler, so useCallback isn't needed
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 @roryabraham 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/roryabraham in version: 9.3.25-0 🚀
|
Explanation of Change
Fixed Issues
$ #76693
PROPOSAL:
Tests
Test 1: VacationDelegatePage
Test 2: VisibilityPage
Test 3: WalletPage
Requirement: Account has bank account
Test 4: ContactMethodDetailsPage
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-01-16.at.01.13.05.mov
Android: mWeb Chrome
Screen.Recording.2026-01-16.at.01.13.47.mov
iOS: Native
Screen.Recording.2026-01-16.at.01.10.50.mov
iOS: mWeb Safari
Screen.Recording.2026-01-16.at.01.12.10.mov
MacOS: Chrome / Safari
ConsolePage.tsx
Screen.Recording.2026-01-16.at.01.09.21.mov
VacationDelegatePage.tsx
Screen.Recording.2026-01-16.at.01.09.55.mov
ContactMethodDetailsPage.tsx
Screen.Recording.2025-12-10.at.01.24.05.mov
WalletPage.tsx
Screen.Recording.2025-12-10.at.01.25.20.mov
VisibilityPage.tsx
Screen.Recording.2025-12-10.at.01.26.03.mov