Skip to content

Commit

Permalink
[SDP-1323] Fix bug introduced in PR #134 where the upload csv button …
Browse files Browse the repository at this point in the history
…would never be enabled (#140)

### What

Fix bug introduced in PR #134 where the upload csv button would never be enabled.

### Why

The bug was caused because the PR removed the `{renderDropdownDefault(isWalletAssetsFetching)}` line of code that inserts the (initial) "empty dropdown value" to the dropdown list, and it resulted in preventing the _dropdown selection changed_ event from being called when the assets dropdown list contained a single item. That mistake prevents disbursement instructions from being uploaded.

### Additional Change(s)

Update the syntax of the javascript filter function to return explicit booleans.

---------

Co-authored-by: Iveta <[email protected]>
  • Loading branch information
marcelosalloum and quietbits authored Aug 27, 2024
1 parent f18aaf3 commit 33bbeae
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/components/DisbursementDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -328,14 +328,15 @@ export const DisbursementDetails: React.FC<DisbursementDetailsProps> = ({
value={details.asset.id}
disabled={isWalletAssetsFetching || !details.wallet.id}
>
{renderDropdownDefault(isWalletAssetsFetching)}
{walletAssets
?.filter((wa: ApiAsset) => {
// Check for the default native asset
if (wa.code == "XLM") {
return wa;
if (wa.code === "XLM" && wa.issuer === "") {
return true;
}
// Check that the asset is non-native asset that has a distribution account balance
return allBalances?.find(
// Check that the asset is a non-native asset that has a distribution account balance
return !!allBalances?.find(
(balance) =>
balance.assetCode === wa.code &&
balance.assetIssuer === wa.issuer,
Expand Down

0 comments on commit 33bbeae

Please sign in to comment.