Skip to content

Commit 65c5325

Browse files
committed
fix: remove balance graph from asset details screen, which occasionaly causes a freeze
1 parent ff7733d commit 65c5325

File tree

1 file changed

+2
-65
lines changed

1 file changed

+2
-65
lines changed

ui/app/AppLayouts/Wallet/views/AssetsDetailView.qml

Lines changed: 2 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@ Item {
3939
onNetworkFiltersChanged: d.forceRefreshBalanceStore = true
4040
/*required*/ property string address: ""
4141

42-
TokenBalanceHistoryData {
43-
id: balanceData
44-
}
45-
4642
TokenMarketValuesData {
4743
id: marketValueData
4844
}
@@ -126,8 +122,7 @@ Item {
126122
}
127123

128124
enum GraphType {
129-
Price = 0,
130-
Balance
125+
Price = 0
131126
}
132127

133128
StatusScrollView {
@@ -180,7 +175,6 @@ Item {
180175

181176
graphsModel: [
182177
{text: qsTr("Price"), enabled: true, id: AssetsDetailView.GraphType.Price, visible: !d.isCommunityAsset},
183-
{text: qsTr("Balance"), enabled: true, id: AssetsDetailView.GraphType.Balance, visible: true},
184178
]
185179
defaultTimeRangeIndexShown: ChartDataBase.TimeRange.All
186180
timeRangeModel: dataReady() && selectedStore.timeRangeTabsModel
@@ -189,23 +183,13 @@ Item {
189183
graphDetail.selectedGraphType = privateIdentifier
190184
}
191185

192-
if(graphDetail.selectedGraphType === AssetsDetailView.GraphType.Balance) {
193-
graphDetail.updateBalanceStore()
194-
}
195-
196186
if(!isTimeRange) {
197-
graphDetail.selectedStore = graphDetail.selectedGraphType === AssetsDetailView.GraphType.Price ? marketValueData : balanceData
187+
graphDetail.selectedStore = marketValueData
198188
}
199189

200190
chart.refresh()
201191
}
202192

203-
readonly property var dateToShortLabel: function (value) {
204-
const range = balanceData.timeRangeStrToEnum(graphDetail.selectedTimeRange)
205-
return range === ChartDataBase.TimeRange.Weekly || range === ChartDataBase.TimeRange.Monthly ?
206-
LocaleUtils.getDayMonth(value) :
207-
LocaleUtils.getMonthYear(value)
208-
}
209193
chart.type: 'line'
210194
chart.labels: root.tokensStore.marketHistoryIsLoading ? [] : graphDetail.labelsData
211195
chart.datasets: {
@@ -242,15 +226,6 @@ Item {
242226
//},
243227
//pan:{enabled:true,mode:'x'},
244228
tooltips: {
245-
format: {
246-
enabled: graphDetail.selectedGraphType === AssetsDetailView.GraphType.Balance,
247-
callback: function (value) {
248-
return graphDetail.dateToShortLabel(value)
249-
},
250-
valueCallback: function(value) {
251-
return root.currencyStore.formatCurrencyAmount(value, root.currencyStore.currentCurrency)
252-
}
253-
},
254229
intersect: false,
255230
displayColors: false,
256231
callbacks: {
@@ -260,9 +235,6 @@ Item {
260235
label += ': ';
261236
}
262237

263-
if (graphDetail.selectedGraphType === AssetsDetailView.GraphType.Balance)
264-
return label + tooltipItem.yLabel // already formatted in tooltips.value.callback
265-
266238
const value = root.currencyStore.formatCurrencyAmount(
267239
tooltipItem.yLabel, root.currencyStore.currentCurrency)
268240

@@ -271,12 +243,6 @@ Item {
271243
}
272244
},
273245
scales: {
274-
labelFormat: {
275-
callback: function (value) {
276-
return graphDetail.dateToShortLabel(value)
277-
},
278-
enabled: graphDetail.selectedGraphType === AssetsDetailView.GraphType.Balance,
279-
},
280246
xAxes: [{
281247
id: 'x-axis-1',
282248
position: 'bottom',
@@ -333,35 +299,6 @@ Item {
333299
active: root.tokensStore.marketHistoryIsLoading
334300
}
335301

336-
function updateBalanceStore() {
337-
let selectedTimeRangeEnum = balanceData.timeRangeStrToEnum(graphDetail.selectedTimeRange)
338-
339-
let currencySymbol = root.currencyStore.currentCurrency
340-
341-
if(!balanceData.hasData(root.address, token.symbol, currencySymbol, selectedTimeRangeEnum) || d.forceRefreshBalanceStore) {
342-
root.tokensStore.fetchHistoricalBalanceForTokenAsJson(root.address, token.symbol, currencySymbol, selectedTimeRangeEnum)
343-
}
344-
}
345-
346-
Connections {
347-
target: balanceData
348-
function onNewDataReady(address, tokenSymbol, currencySymbol, timeRange) {
349-
d.forceRefreshBalanceStore = false
350-
if (timeRange === balanceData.timeRangeStrToEnum(graphDetail.selectedTimeRange)) {
351-
chart.refresh()
352-
}
353-
}
354-
}
355-
356-
Connections {
357-
target: root
358-
function onAddressChanged() { graphDetail.updateBalanceStore() }
359-
}
360-
361-
Connections {
362-
target: d
363-
function onSymbolChanged() { if (d.symbol) graphDetail.updateBalanceStore() }
364-
}
365302
}
366303
}
367304

0 commit comments

Comments
 (0)