fix(deal-ticket): prevent empty call estimate position (#4950)
This commit is contained in:
parent
8efadda98c
commit
6c5cd85d96
@ -264,7 +264,11 @@ export const DealTicket = ({
|
||||
orders,
|
||||
collateralAvailable:
|
||||
marginAccountBalance || generalAccountBalance ? balance : undefined,
|
||||
skip: !normalizedOrder,
|
||||
skip:
|
||||
!normalizedOrder ||
|
||||
(normalizedOrder.type !== Schema.OrderType.TYPE_MARKET &&
|
||||
(!normalizedOrder.price || normalizedOrder.price === '0')) ||
|
||||
normalizedOrder.size === '0',
|
||||
});
|
||||
|
||||
const assetSymbol = getAsset(market).symbol;
|
||||
|
@ -30,9 +30,11 @@ export const usePositionEstimate = ({
|
||||
fetchPolicy: 'no-cache',
|
||||
});
|
||||
useEffect(() => {
|
||||
if (data) {
|
||||
if (skip) {
|
||||
setEstimates(undefined);
|
||||
} else if (data) {
|
||||
setEstimates(data);
|
||||
}
|
||||
}, [data]);
|
||||
}, [data, skip]);
|
||||
return estimates;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user