Fix receipt empty state not showing for time expense from FAB#85315
Fix receipt empty state not showing for time expense from FAB#85315cristipaval merged 7 commits intomainfrom
Conversation
When creating a time expense from the FAB, the iouType is CREATE. IOURequestStepHours was passing this raw CREATE type to the confirmation page, where shouldShowReceiptEmptyState only handles SUBMIT, TRACK, and PAY types. This caused the receipt empty state to not appear. Resolve CREATE to SUBMIT before navigating to confirmation, matching the established pattern in IOURequestStepAmount. Co-authored-by: Aimane Chnaif <aimane-chnaif@users.noreply.github.com>
Co-authored-by: Aimane Chnaif <aimane-chnaif@users.noreply.github.com>
|
Fixed the failing Prettier check: wrapped a long |
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@MelvinBot mark as ready for review |
|
PR has been marked as ready for review. |
|
@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] |
|
@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] |
|
@MelvinBot add unit test as per #85315 (comment) |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppios.moviOS: mWeb SafariMacOS: Chrome / Safariweb.mov |
|
|
||
| return Navigation.setNavigationActionToMicrotaskQueue(() => | ||
| Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_CONFIRMATION.getRoute(CONST.IOU.ACTION.CREATE, iouType, transactionID, policyExpenseChat.reportID)), | ||
| Navigation.navigate( |
There was a problem hiding this comment.
❌ CONSISTENCY-3 (docs)
The inline expression iouType === CONST.IOU.TYPE.CREATE ? CONST.IOU.TYPE.SUBMIT : iouType duplicates iouType resolution logic that already exists in navigateToConfirmationPage in src/libs/IOUUtils.ts. That utility already handles mapping raw iouType values (like REQUEST -> SUBMIT, SEND -> PAY) when navigating to the confirmation page. Instead of adding another inline resolution here (and in a second place at line 130), consider either:
- Using
navigateToConfirmationPagedirectly (it already handles theCREATE->SUBMITmapping via itsshouldNavigateToSubmitparameter in the default branch), or - Extending
navigateToConfirmationPageto handle theCREATEtype explicitly in its switch statement, so all iouType resolution for confirmation navigation is centralized.
Note that IOURequestStepParticipants.tsx (line 353) has a similar but broader pattern that also maps TRACK -> SUBMIT: iouType === CONST.IOU.TYPE.CREATE || iouType === CONST.IOU.TYPE.TRACK ? CONST.IOU.TYPE.SUBMIT : iouType. Centralizing this logic would prevent these scattered inline mappings from diverging.
Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
There was a problem hiding this comment.
Addressed this by adding a CREATE case to the navigateToConfirmationPage switch in IOUUtils.ts, then updating IOURequestStepHours to use navigateToConfirmationPage instead of inline iouType resolution. This centralizes the CREATE → SUBMIT mapping alongside the existing REQUEST → SUBMIT and SEND → PAY mappings.
Also updated the relevant unit tests in IOUUtilsTest.ts (updated existing test + added new test for reportIDParam handling) and adjusted IOURequestStepHoursTest.tsx accordingly.
…tepHours Adds tests to cover the iouType conversion logic that resolves CREATE to SUBMIT when navigating to the confirmation page, addressing the Codecov coverage decrease. Co-authored-by: Aimane Chnaif <aimane-chnaif@users.noreply.github.com>
|
Added unit tests for the
All 10 tests pass (8 existing + 2 new). |
|
@cristipaval 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] |
Co-authored-by: Aimane Chnaif <aimane-chnaif@users.noreply.github.com>
|
Fixed the failing Prettier check: applied Prettier formatting to |
Narrow the iouType parameter type in renderComponent to match the route param types for STEP_HOURS and STEP_HOURS_EDIT screens, which exclude REQUEST and SEND iou types. Co-authored-by: Aimane Chnaif <aimane-chnaif@users.noreply.github.com>
|
Fixed the failing TypeScript check: narrowed the |
Address CONSISTENCY-3 review comment by adding a CREATE case to the navigateToConfirmationPage switch in IOUUtils.ts, then using navigateToConfirmationPage in IOURequestStepHours instead of inline iouType resolution. Co-authored-by: Aimane Chnaif <aimane-chnaif@users.noreply.github.com>
…FAB' into claude-fixTimeExpenseReceiptFromFAB Co-authored-by: Aimane Chnaif <aimane-chnaif@users.noreply.github.com>
|
The failing typecheck has been fixed in commit b3ed415. The issue was a TypeScript type mismatch in The fix narrows the type to All checks are now passing: typecheck, tests (all 8 jobs), ESLint, Prettier, builds, storybook, spellcheck, and CLA. |
Code ReviewOverall: The fix correctly addresses the reported bug — time expenses created from the FAB now resolve Code Changes
The new
One thing to note:
The change from direct TestsThe new unit tests (
Minor gap: The old test for VerdictThe changes are correct and well-scoped. No blockers. |
|
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". |
|
🚧 @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! 🧪🧪
|
|
✋ 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/cristipaval in version: 9.3.39-0 🚀
|
|
🚀 Deployed to production by https://github.com/cristipaval in version: 9.3.39-3 🚀
|
Explanation of Change
When creating a time expense from the FAB (+ > Create expense > Time),
IOURequestStepHourspasses the rawiouType(create) through to the confirmation page. However,shouldShowReceiptEmptyStateinIOUUtils.tsonly returnstrueforsubmit,track, orpaytypes — notcreate. This causes the receipt empty state to be hidden on the confirmation page.This PR resolves the
CREATEiouType toSUBMITbefore navigating to the confirmation page inIOURequestStepHours.saveTime(), matching the established pattern used byIOURequestStepAmount(which already convertsCREATEto eitherSUBMITorTRACKbefore navigating).Since time expenses always require a workspace (time tracking is a workspace feature),
SUBMITis the correct resolved type.Fixed Issues
$ #81143
PROPOSAL: #81143 (comment)
Tests
Offline tests
N/A — This change only affects navigation routing to the confirmation page and does not involve network requests.
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand 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: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari