Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/components/KYCWall/BaseKYCWall.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ function KYCWall({

const invoiceReceiverPolicyID = getInvoiceReceiverPolicyID(chatReport);
const invoiceReceiverPolicy = invoiceReceiverPolicyID ? policies?.[`${ONYXKEYS.COLLECTION.POLICY}${invoiceReceiverPolicyID}`] : undefined;
const bankAccountRoute = addBankAccountRoute ?? getBankAccountRoute(chatReport, invoiceReceiverPolicy?.areInvoicesEnabled);
const resolvedAddBankAccountRoute = typeof addBankAccountRoute === 'function' ? addBankAccountRoute() : addBankAccountRoute;
const bankAccountRoute = resolvedAddBankAccountRoute ?? getBankAccountRoute(chatReport, invoiceReceiverPolicy?.areInvoicesEnabled);
Navigation.navigate(bankAccountRoute);
}
},
Expand Down
4 changes: 2 additions & 2 deletions src/components/KYCWall/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ type ContinueActionParams = {
};

type KYCWallProps = {
/** Route for the Add Bank Account screen for a given navigation stack */
addBankAccountRoute?: Route;
/** Route for the Add Bank Account screen for a given navigation stack. Pass a function to defer building the route (e.g. its backTo) until the moment of the press. */
addBankAccountRoute?: Route | (() => Route | undefined);

/** Route for the Add Debit Card screen for a given navigation stack */
addDebitCardRoute?: Route;
Expand Down
4 changes: 3 additions & 1 deletion src/components/Search/SearchBulkActionsButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ function SearchBulkActionsButton({queryJSON}: SearchBulkActionsButtonProps) {
enablePaymentsRoute={ROUTES.ENABLE_PAYMENTS}
iouReport={selectedIOUReport}
addBankAccountRoute={
isCurrentSelectedExpenseReport ? ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute({policyID: currentSelectedPolicyID, backTo: Navigation.getActiveRoute()}) : undefined
isCurrentSelectedExpenseReport
? () => ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute({policyID: currentSelectedPolicyID, backTo: Navigation.getActiveRoute()})
: undefined
}
onSuccessfulKYC={(paymentType) => {
confirmPayment?.(paymentType, pendingPaymentAdditionalDataRef.current);
Expand Down
2 changes: 1 addition & 1 deletion src/components/SettlementButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ function SettlementButton({
isDisabled={isOffline}
source={CONST.KYC_WALL_SOURCE.REPORT}
chatReportID={chatReportID}
addBankAccountRoute={isExpenseReport ? ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute({policyID: iouReport?.policyID, backTo: Navigation.getActiveRoute()}) : undefined}
addBankAccountRoute={isExpenseReport ? () => ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute({policyID: iouReport?.policyID, backTo: Navigation.getActiveRoute()}) : undefined}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Resolve backTo instead of timing hydration

When the expense report route is still represented as an unresolved nested navigation intent (the case this change is trying to handle), this callback still asks Navigation.getActiveRoute() to serialize that same unhydrated state, so a fast tap or slow navigation hydration can still encode the malformed /?params=[object Object] value into backTo and send the bank-account Back flow to Inbox. Please derive backTo from a resolved report/search route or fix getPathFromState before building this route rather than relying on hydration finishing before the press.

Useful? React with 👍 / 👎.

@jmusial jmusial Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this case is realistic.

iouReport={iouReport}
policy={lastPaymentPolicy}
anchorAlignment={kycWallAnchorAlignment}
Expand Down
Loading