mirror of
https://github.com/oceanprotocol/docs.git
synced 2024-11-26 19:49:26 +01:00
update state only when numbers have changed
This commit is contained in:
parent
3f378e0a75
commit
14fad134c8
@ -121,7 +121,15 @@ class Numbers extends PureComponent {
|
||||
})
|
||||
|
||||
const { forks, stars } = repo
|
||||
this.setState({ forks, stars })
|
||||
|
||||
// update state only when numbers have changed
|
||||
if (forks && forks !== this.props.forkCount) {
|
||||
this.setState({ forks })
|
||||
}
|
||||
|
||||
if (stars && stars !== this.props.stargazers.totalCount) {
|
||||
this.setState({ stars })
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error) // eslint-disable-line no-console
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user