Fix exception in detail_trade when selected trade closes

This commit is contained in:
Matthias 2023-01-24 07:03:01 +01:00
parent 06a73c9485
commit 048da545d0
3 changed files with 11 additions and 4 deletions

View File

@ -121,13 +121,13 @@ export function createBotSubStore(botId: string, botName: string) {
: b.trade_id - a.trade_id, : b.trade_id - a.trade_id,
); );
}, },
tradeDetail: (state) => { tradeDetail: (state): Trade | undefined => {
// console.log('tradeDetail', state.openTrades.length, state.openTrades); // console.log('tradeDetail', state.openTrades.length, state.openTrades);
let dTrade = state.openTrades.find((item) => item.trade_id === state.detailTradeId); let dTrade = state.openTrades.find((item) => item.trade_id === state.detailTradeId);
if (!dTrade) { if (!dTrade) {
dTrade = state.trades.find((item) => item.trade_id === state.detailTradeId); dTrade = state.trades.find((item) => item.trade_id === state.detailTradeId);
} }
return dTrade as Trade; return dTrade;
}, },
refreshNow: (state) => { refreshNow: (state) => {
if ( if (

View File

@ -22,7 +22,10 @@
:stake-currency-decimals="botStore.activeBot.stakeCurrencyDecimals" :stake-currency-decimals="botStore.activeBot.stakeCurrencyDecimals"
empty-text="No closed trades so far." empty-text="No closed trades so far."
/> />
<div v-if="botStore.activeBot.detailTradeId" class="d-flex flex-column"> <div
v-if="botStore.activeBot.detailTradeId && botStore.activeBot.tradeDetail"
class="d-flex flex-column"
>
<b-button <b-button
size="sm" size="sm"
class="align-self-start mt-1 ms-1" class="align-self-start mt-1 ms-1"

View File

@ -100,7 +100,11 @@
</DraggableContainer> </DraggableContainer>
</grid-item> </grid-item>
<grid-item <grid-item
v-if="botStore.activeBot.detailTradeId && gridLayoutTradeDetail.h != 0" v-if="
botStore.activeBot.detailTradeId &&
botStore.activeBot.tradeDetail &&
gridLayoutTradeDetail.h != 0
"
v-bind="gridItemProps" v-bind="gridItemProps"
:i="gridLayoutTradeDetail.i" :i="gridLayoutTradeDetail.i"
:x="gridLayoutTradeDetail.x" :x="gridLayoutTradeDetail.x"