mirror of
https://github.com/status-im/fathom.git
synced 2025-02-28 19:10:36 +00:00
delay initial request until datepicker component bubbled up the correct period
This commit is contained in:
parent
e73a205d26
commit
3c823e9351
@ -24,10 +24,6 @@ class CountWidget extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.fetchData();
|
||||
}
|
||||
|
||||
componentWillReceiveProps(newProps, prevState) {
|
||||
if(newProps.before == prevState.before && newProps.after == prevState.after) {
|
||||
return;
|
||||
|
@ -31,9 +31,7 @@ class DatePicker extends Component {
|
||||
before: 0,
|
||||
after: 0,
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.setTimeRange(this.state.period)
|
||||
}
|
||||
|
||||
|
@ -21,10 +21,6 @@ class Table extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.fetchRecords()
|
||||
}
|
||||
|
||||
componentWillReceiveProps(newProps, prevState) {
|
||||
if(newProps.before == prevState.before && newProps.after == prevState.after) {
|
||||
return;
|
||||
@ -40,9 +36,16 @@ class Table extends Component {
|
||||
@bind
|
||||
fetchRecords() {
|
||||
this.setState({ loading: true });
|
||||
let before = this.state.before;
|
||||
let after = this.state.after;
|
||||
|
||||
Client.request(`${this.props.endpoint}?before=${this.state.before}&after=${this.state.after}&limit=${this.state.limit}`)
|
||||
.then((d) => {
|
||||
// request finished; check if timestamp range is still the one user wants to see
|
||||
if( this.state.before != before || this.state.after != after ) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState({
|
||||
loading: false,
|
||||
records: d,
|
||||
|
Loading…
x
Reference in New Issue
Block a user