fix(markets): key details panel crashing (#5683)

This commit is contained in:
Art 2024-01-29 14:22:17 +01:00 committed by GitHub
parent cff1818940
commit 9153677a33
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -210,10 +210,15 @@ export const KeyDetailsInfoPanel = ({
skip: !featureFlags.SUCCESSOR_MARKETS || !market.proposal?.id, skip: !featureFlags.SUCCESSOR_MARKETS || !market.proposal?.id,
}); });
const successorProposal = const successorProposal = successorProposalDetails?.proposal as
successorProposalDetails?.proposal as SingleProposal< | SingleProposal<SuccessorMarketProposalDetailsQuery['proposal']>
SuccessorMarketProposalDetailsQuery['proposal'] | undefined;
>;
const successorConfiguration =
successorProposal?.terms.change.__typename === 'NewMarket' &&
successorProposal.terms.change.successorConfiguration?.__typename ===
'SuccessorConfiguration' &&
successorProposal.terms.change.successorConfiguration;
// The following queries are needed as the parent market could also have been a successor market. // The following queries are needed as the parent market could also have been a successor market.
// Note: the parent market is only passed to this component if the successor markets flag is enabled, // Note: the parent market is only passed to this component if the successor markets flag is enabled,
@ -232,10 +237,9 @@ export const KeyDetailsInfoPanel = ({
}, },
skip: !parentMarket?.proposal?.id, skip: !parentMarket?.proposal?.id,
}); });
const parentProposal = const parentProposal = parentSuccessorProposalDetails?.proposal as
parentSuccessorProposalDetails?.proposal as SingleProposal< | SingleProposal<SuccessorMarketProposalDetailsQuery['proposal']>
SuccessorMarketProposalDetailsQuery['proposal'] | undefined;
>;
const assetDecimals = getAsset(market).decimals; const assetDecimals = getAsset(market).decimals;
@ -259,16 +263,13 @@ export const KeyDetailsInfoPanel = ({
</KeyValueTable> </KeyValueTable>
<MarketInfoTable <MarketInfoTable
data={ data={
featureFlags.SUCCESSOR_MARKETS featureFlags.SUCCESSOR_MARKETS && successorConfiguration
? { ? {
name: market.tradableInstrument.instrument.name, name: market.tradableInstrument.instrument.name,
parentMarketID: parentMarketID:
parentMarketIdData?.market?.parentMarketID || '-', parentMarketIdData?.market?.parentMarketID || '-',
insurancePoolFraction: insurancePoolFraction:
(successorProposal.terms.change.__typename === 'NewMarket' && successorConfiguration.insurancePoolFraction || '-',
successorProposal.terms.change.successorConfiguration
?.insurancePoolFraction) ||
'-',
status: market.state && MarketStateMapping[market.state], status: market.state && MarketStateMapping[market.state],
tradingMode: tradingMode:
market.tradingMode && market.tradingMode &&