Skip to content

Commit

Permalink
Add back OnyxData, but with Policy loading key
Browse files Browse the repository at this point in the history
  • Loading branch information
nkuoch committed Mar 26, 2024
1 parent 8dc35ac commit 354a2f6
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
32 changes: 31 additions & 1 deletion src/libs/actions/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2202,9 +2202,39 @@ function openPolicyWorkflowsPage(policyID: string) {
return;
}

const onyxData: OnyxData = {
optimisticData: [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`,
value: {
isLoading: true,
},
},
],
successData: [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`,
value: {
isLoading: false,
},
},
],
failureData: [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`,
value: {
isLoading: false,
},
},
],
};

const params: OpenPolicyWorkflowsPageParams = {policyID};

API.read(READ_COMMANDS.OPEN_POLICY_WORKFLOWS_PAGE, params);
API.read(READ_COMMANDS.OPEN_POLICY_WORKFLOWS_PAGE, params, onyxData);
}

function setPolicyIDForReimburseView(policyID: string) {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/workspace/workflows/WorkspaceWorkflowsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ function WorkspaceWorkflowsPage({policy, betas, route, session}: WorkspaceWorkfl
const optionItems: ToggleSettingOptionRowProps[] = useMemo(() => {
const {accountNumber, addressName, bankName} = policy?.achAccount ?? {};
const hasVBA = !!policy?.achAccount;
let bankDisplayName = bankName || addressName;
let bankDisplayName = bankName ?? addressName;
if (accountNumber && bankDisplayName !== accountNumber) {
bankDisplayName += ' ' + accountNumber.slice(-5);
bankDisplayName += ` ${accountNumber.slice(-5)}`;
}
const hasReimburserEmailError = !!policy?.errorFields?.reimburserEmail;
const hasApprovalError = !!policy?.errorFields?.approvalMode;
Expand Down

0 comments on commit 354a2f6

Please sign in to comment.