Skip to content
Merged
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
2 changes: 1 addition & 1 deletion src/libs/actions/Link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ function openLink(href: string, environmentURL: string, isAttachment = false) {
function buildURLWithAuthToken(url: string, shortLivedAuthToken?: string) {
const authTokenParam = shortLivedAuthToken ? `shortLivedAuthToken=${shortLivedAuthToken}` : '';
const emailParam = `email=${encodeURIComponent(currentUserEmail)}`;
const exitTo = `exitTo=${url}`;
const exitTo = `exitTo=${encodeURIComponent(url)}`;
const accountID = `accountID=${currentUserAccountID}`;
const referrer = 'referrer=desktop';
const paramsArray = [accountID, emailParam, authTokenParam, exitTo, referrer];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,9 @@ function ReimbursementAccountPage({route, policy, isLoadingPolicy}: Reimbursemen
return;
}

setReimbursementAccountLoading(true);
if (policyIDParam) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we just return early here if there is no policyIDParam?
We don't need to call clearReimbursementAccountDraft and fetchData won't be called if there is no policyID. Or do we still need isStepToOpenEmpty check in this case?

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 follow why we don't need to call clearReimbursementAccountDraft. isStepToOpenEmpty is not related to the policyID param, so I would leave it as it is. We can update the code to this if needed:

...
const isStepToOpenEmpty = getStepToOpenFromRouteParams(route) === '';
if (isStepToOpenEmpty) {
  setBankAccountSubStep(null);
  setPlaidEvent(null);
}

if (!policyIDParam) {
  return;
}
setReimbursementAccountLoading(true);
fetchData();

setReimbursementAccountLoading(true);
}
clearReimbursementAccountDraft();

// If the step to open is empty, we want to clear the sub step, so the connect option view is shown to the user
Expand Down