Skip to content

Commit

Permalink
Rework and optimize concetration risk refreshing flow
Browse files Browse the repository at this point in the history
  • Loading branch information
alexstotsky committed Aug 22, 2024
1 parent d1962a7 commit 2da2b00
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/components/ConcentrationRisk/ConcentrationRisk.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
} from 'ui/SectionHeader'
import DataTable from 'ui/DataTable'
import DateInput from 'ui/DateInput'
import QueryButton from 'ui/QueryButton'
import PieChart from 'ui/Charts/PieChart'
import RefreshButton from 'ui/RefreshButton'
import SectionSwitch from 'ui/SectionSwitch'
Expand All @@ -37,7 +36,6 @@ class ConcentrationRisk extends PureComponent {
dataReceived: PropTypes.bool.isRequired,
pageLoading: PropTypes.bool.isRequired,
isSyncRequired: PropTypes.bool.isRequired,
refresh: PropTypes.func.isRequired,
t: PropTypes.func.isRequired,
}

Expand Down Expand Up @@ -114,7 +112,7 @@ class ConcentrationRisk extends PureComponent {
}
}

handleQuery = () => {
handleRefresh = () => {
const { fetchWallets } = this.props
const { timestamp } = this.state
const time = timestamp ? timestamp.getTime() : null
Expand All @@ -125,15 +123,12 @@ class ConcentrationRisk extends PureComponent {
const {
t,
entries,
refresh,
pageLoading,
currentTime,
dataReceived,
} = this.props
const isNoData = isEmpty(entries)
const isLoading = !dataReceived && pageLoading
const { timestamp } = this.state
const hasNewTime = timestamp ? currentTime !== timestamp.getTime() : !!currentTime !== !!timestamp

const filteredData = entries.filter(entry => entry.balanceUsd)

Expand Down Expand Up @@ -192,11 +187,7 @@ class ConcentrationRisk extends PureComponent {
onChange={this.handleDateChange}
/>
</SectionHeaderItem>
<QueryButton
disabled={!hasNewTime}
onClick={this.handleQuery}
/>
<RefreshButton onClick={refresh} />
<RefreshButton onClick={this.handleRefresh} />
</SectionHeaderRow>
</SectionHeader>
{showContent}
Expand Down

0 comments on commit 2da2b00

Please sign in to comment.