Better fallbacks for data fetching

log-viewer/small-cleanup
Brandon Farmer 2018-07-13 15:00:31 -07:00
parent ad4dcb3147
commit 97edcf81da
1 changed files with 8 additions and 2 deletions

View File

@ -346,7 +346,12 @@ class LogsTable extends Component<Props, State> {
} }
const data = getValuesFromData(this.props.tableInfiniteData.forward) const data = getValuesFromData(this.props.tableInfiniteData.forward)
const firstTime = getDeep(data, '0.0', new Date().getTime() / 1000) const backwardData = getValuesFromData(this.props.tableInfiniteData.forward)
const firstTime = getDeep(
data,
'0.0',
getDeep(backwardData, '0.0', new Date().getTime())
)
const {firstQueryTime} = this.state const {firstQueryTime} = this.state
if (firstQueryTime && firstQueryTime > firstTime) { if (firstQueryTime && firstQueryTime > firstTime) {
return return
@ -364,11 +369,12 @@ class LogsTable extends Component<Props, State> {
} }
const data = getValuesFromData(this.props.tableInfiniteData.backward) const data = getValuesFromData(this.props.tableInfiniteData.backward)
const forwardData = getValuesFromData(this.props.tableInfiniteData.forward)
const lastTime = getDeep( const lastTime = getDeep(
data, data,
`${data.length - 1}.0`, `${data.length - 1}.0`,
new Date().getTime() / 1000 getDeep(forwardData, `${forwardData.length - 1}.0`, new Date().getTime())
) )
// Guard against fetching on scrolling back up then down // Guard against fetching on scrolling back up then down