Skip to content

Commit

Permalink
set default bank account when none is selected on selector
Browse files Browse the repository at this point in the history
  • Loading branch information
twilight2294 authored Nov 22, 2024
1 parent 4179eef commit eda2c6b
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ function XeroBankAccountSelectPage({policy}: WithPolicyConnectionsProps) {
const policyID = policy?.id ?? '-1';

const {config} = policy?.connections?.xero ?? {};
const {bankAccounts} = policy?.connections?.xero?.data ?? {};
const xeroSelectorOptions = useMemo<SelectorType[]>(
() => getXeroBankAccounts(policy ?? undefined, config?.export?.nonReimbursableAccount),
[config?.export?.nonReimbursableAccount, policy],
() => getXeroBankAccounts(policy ?? undefined, config?.export?.nonReimbursableAccount || bankAccounts?.[0]?.id),

Check failure on line 32 in src/pages/workspace/accounting/xero/export/XeroBankAccountSelectPage.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

Prefer using nullish coalescing operator (`??`) instead of a logical or (`||`), as it is a safer operator

Check failure on line 32 in src/pages/workspace/accounting/xero/export/XeroBankAccountSelectPage.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Prefer using nullish coalescing operator (`??`) instead of a logical or (`||`), as it is a safer operator
[config?.export?.nonReimbursableAccount, policy, bankAccounts],
);

const listHeaderComponent = useMemo(
Expand Down

0 comments on commit eda2c6b

Please sign in to comment.