fix(trading): prevent overflow in deal ticket if market fails to load (#4535)

This commit is contained in:
Matthew Russell 2023-08-11 17:03:17 +01:00 committed by GitHub
parent 39aa27f332
commit 98fd79bc35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,7 +9,7 @@ import {
useMarket, useMarket,
useMarketPrice, useMarketPrice,
} from '@vegaprotocol/markets'; } from '@vegaprotocol/markets';
import { AsyncRenderer, Splash } from '@vegaprotocol/ui-toolkit'; import { AsyncRendererInline } from '@vegaprotocol/ui-toolkit';
import { t } from '@vegaprotocol/i18n'; import { t } from '@vegaprotocol/i18n';
import { DealTicket } from './deal-ticket'; import { DealTicket } from './deal-ticket';
import { FLAGS } from '@vegaprotocol/environment'; import { FLAGS } from '@vegaprotocol/environment';
@ -42,7 +42,7 @@ export const DealTicketContainer = ({
const { data: marketPrice } = useMarketPrice(market?.id); const { data: marketPrice } = useMarketPrice(market?.id);
const create = useVegaTransactionStore((state) => state.create); const create = useVegaTransactionStore((state) => state.create);
return ( return (
<AsyncRenderer <AsyncRendererInline
data={market && marketData} data={market && marketData}
loading={marketLoading || marketDataLoading} loading={marketLoading || marketDataLoading}
error={marketError || marketDataError} error={marketError || marketDataError}
@ -65,10 +65,8 @@ export const DealTicketContainer = ({
/> />
) )
) : ( ) : (
<Splash>
<p>{t('Could not load market')}</p> <p>{t('Could not load market')}</p>
</Splash>
)} )}
</AsyncRenderer> </AsyncRendererInline>
); );
}; };