Skip to content

Commit

Permalink
fix(trading): missing party ID when there is no SLA data (#5446)
Browse files Browse the repository at this point in the history
Co-authored-by: Matthew Russell <[email protected]>
  • Loading branch information
MadalinaRaicu and mattrussell36 authored Dec 5, 2023
1 parent 8a3657a commit 51ab02a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 2 additions & 0 deletions libs/liquidity/src/lib/liquidity-data-provider.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ describe('getLiquidityProvision', () => {
createdAt: '2022-12-16T09:28:29.071781Z',
id: 'dde288688af2aeb5feb349dd72d3679a7a9be34c7375f6a4a48ef2f6140e7e59',
fee: '0.001',
partyId:
'dde288688af2aeb5feb349dd72d3679a7a9be34c7375f6a4a48ef2f6140e7e59',
party: {
__typename: 'Party',
accountsConnection: {
Expand Down
13 changes: 9 additions & 4 deletions libs/liquidity/src/lib/liquidity-data-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@ import {
} from '@vegaprotocol/data-provider';
import * as Schema from '@vegaprotocol/types';
import BigNumber from 'bignumber.js';

import {
LiquidityProvidersDocument,
LiquidityProvisionsDocument,
} from './__generated__/MarketLiquidity';

import type {
LiquidityProviderFieldsFragment,
LiquidityProvisionFieldsFragment,
LiquidityProvidersQuery,
LiquidityProvidersQueryVariables,
LiquidityProvisionFieldsFragment,
LiquidityProvisionsQuery,
LiquidityProvisionsQueryVariables,
} from './__generated__/MarketLiquidity';
Expand Down Expand Up @@ -163,7 +161,14 @@ export const getLiquidityProvision = (
const liquidityProvider = liquidityProviders.find(
(f) => liquidityProvision.party.id === f.partyId
);
if (!liquidityProvider) return liquidityProvision;

if (!liquidityProvider) {
return {
...liquidityProvision,
partyId: liquidityProvision.party.id,
};
}

const accounts = compact(
liquidityProvision.party.accountsConnection?.edges
).map((e) => e.node);
Expand Down

0 comments on commit 51ab02a

Please sign in to comment.