-
Notifications
You must be signed in to change notification settings - Fork 3.7k
fix: Add receipt from manual expense, QAB is scan receipt but confirm detail display as manual v2 #77849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mjasikowski
merged 8 commits into
Expensify:main
from
nkdengineer:revert-77674-revert-76799-fix/74911
Jan 12, 2026
Merged
fix: Add receipt from manual expense, QAB is scan receipt but confirm detail display as manual v2 #77849
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c1db378
Revert "[CP Staging] Revert "fix: Add receipt from manual expense, QA…
nkdengineer ba14da3
Merge branch 'main' into revert-77674-revert-76799-fix/74911
nkdengineer 31b504c
fix transaction is undefined
nkdengineer 6441421
disable dependency rule
nkdengineer 9ba9bec
remove log
nkdengineer a3fd561
Merge branch 'main' into revert-77674-revert-76799-fix/74911
nkdengineer ef78486
add comment
nkdengineer a6110e6
update comment
nkdengineer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,7 +69,9 @@ function IOURequestStartPage({ | |
| const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {canBeMissing: true}); | ||
| const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID}`, {canBeMissing: true}); | ||
| const policy = usePolicy(report?.policyID); | ||
| const [selectedTab, selectedTabResult] = useOnyx(`${ONYXKEYS.COLLECTION.SELECTED_TAB}${CONST.TAB.IOU_REQUEST_TYPE}`, {canBeMissing: true}); | ||
| const [lastSelectedTab, selectedTabResult] = useOnyx(`${ONYXKEYS.COLLECTION.SELECTED_TAB}${CONST.TAB.IOU_REQUEST_TYPE}`, {canBeMissing: true}); | ||
| const [selectedTab, setSelectedTab] = useState(lastSelectedTab); | ||
|
|
||
| const isLoadingSelectedTab = shouldUseTab ? isLoadingOnyxValue(selectedTabResult) : false; | ||
| const [transaction, transactionResult] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${getNonEmptyStringOnyxID(route?.params.transactionID)}`, {canBeMissing: true}); | ||
| const isLoadingTransaction = isLoadingOnyxValue(transactionResult); | ||
|
|
@@ -135,6 +137,16 @@ function IOURequestStartPage({ | |
| Performance.markEnd(CONST.TIMING.OPEN_CREATE_EXPENSE); | ||
| }, []); | ||
|
|
||
| useEffect(() => { | ||
| if (isLoadingSelectedTab || selectedTab) { | ||
| return; | ||
| } | ||
| setSelectedTab(lastSelectedTab); | ||
| // We only want to set the selected tab when selectedTab is not set yet, don't want to run this effect again when lastSelectedTab changes | ||
| // eslint-disable-next-line react-compiler/react-compiler | ||
| // eslint-disable-next-line react-hooks/exhaustive-deps | ||
| }, [isLoadingSelectedTab, selectedTab]); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this caused We should let this useEffect run when lastSelectedTab is changed. It won't be a problem as there's a early return check. |
||
|
|
||
| const navigateBack = () => { | ||
| Navigation.closeRHPFlow(); | ||
| }; | ||
|
|
@@ -177,6 +189,14 @@ function IOURequestStartPage({ | |
| ], | ||
| ); | ||
|
|
||
| const onTabSelected = useCallback( | ||
| (newIouType: IOURequestType) => { | ||
| setSelectedTab(newIouType); | ||
| resetIOUTypeIfChanged(newIouType); | ||
| }, | ||
| [resetIOUTypeIfChanged], | ||
| ); | ||
|
|
||
| // Clear out the temporary expense if the reportID in the URL has changed from the transaction's reportID. | ||
| useFocusEffect( | ||
| useCallback(() => { | ||
|
|
@@ -253,7 +273,7 @@ function IOURequestStartPage({ | |
| <OnyxTabNavigator | ||
| id={CONST.TAB.IOU_REQUEST_TYPE} | ||
| defaultSelectedTab={defaultSelectedTab} | ||
| onTabSelected={resetIOUTypeIfChanged} | ||
| onTabSelected={onTabSelected} | ||
| tabBar={TabSelector} | ||
| onTabBarFocusTrapContainerElementChanged={setTabBarContainerElement} | ||
| onActiveTabFocusTrapContainerElementChanged={setActiveTabContainerElement} | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment so everyone knows why the ESLint rules are disabled without looking for context?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mjasikowski I updated
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nkdengineer sorry, but your comment doesn't explain why the rules are getting disabled, It only explains the usage of
useEffect()There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mjasikowski I updated.