bugfix for order display switching symbols

This commit is contained in:
tim
2024-10-27 18:56:36 -04:00
parent dfcadb1ec2
commit 8a34c55fe0
2 changed files with 19 additions and 9 deletions

View File

@@ -1,7 +1,7 @@
<template>
<div>
<v-data-table :headers="datatableHeaders" :items="orders" item-value="id"
:show-select="true" :show-expand="true" v-model="selected">
:show-select="true" :show-expand="true" v-model="selected" select-strategy="single">
<template v-slot:item.startTime="{ value }">{{ timestampString(value) }}</template>
<template v-slot:item.input="{ item }">
<span v-if="item.order.amountIsInput">
@@ -110,7 +110,7 @@
<span v-if="item.state > OrderState.Signing">
<pulse :touch="item.trancheStatus[i].filledIn">
<token-amount :chain-id="item.chainId" :addr="item.order.tokenIn"
:amount="item.trancheStatus[i].filledIn" :raw="true"/>
:amount="item.trancheStatus[i].filledIn" :raw="item.order.amountIsInput"/>
</pulse>
</span>
</suspense>
@@ -127,9 +127,8 @@
<span v-if="item.state > OrderState.Signing">
<pulse :touch="item.trancheStatus[i].filledOut">
<token-amount :chain-id="item.chainId" :addr="item.order.tokenOut"
:amount="item.trancheStatus[i].filledOut" :raw="true"/>
:amount="item.trancheStatus[i].filledOut" :raw="!item.order.amountIsInput"/>
</pulse>
<token-symbol :addr="item.order.tokenOut"/>
</span>
</suspense>
<suspense>
@@ -195,21 +194,30 @@ watch(selected, async ()=>{
const ticker = tickerForOrder(chainId, status.order)
const symbol = lookupSymbol(ticker)
if (co.selectedSymbol.ticker !== ticker) {
co.selectedSymbol = symbol
// switch symbol
deleteOrderShapes()
await setSymbol(symbol)
console.log('change symbol completed')
}
console.log('creating order shape', id)
orderShapes[id] = new OrderShapes(symbol, status)
}
}
deleteOrderShapes(selectedIndex)
})
function deleteOrderShapes(keepSet={}) {
// now delete old shapes
const keys = [...Object.keys(orderShapes)]
for (const id of keys) {
if (!(id in selectedIndex)) {
if (!(id in keepSet)) {
console.log('deleting order shape', id)
orderShapes[id].delete()
delete orderShapes[id]
}
}
})
}
const orderShapes = {}