Merge pull request #398 from filecoin-project/fix/pond/explorer
Fix block order in pond chain explorer
This commit is contained in:
commit
3a26bb22db
@ -60,10 +60,10 @@ class ChainExplorer extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fetch(h, base, cache, msgcache) {
|
async fetch(h, base, cache, msgcache) {
|
||||||
console.log(h, base, cache)
|
//console.log(h, base, cache)
|
||||||
|
|
||||||
if (this.fetching[h]) {
|
if (this.fetching[h]) {
|
||||||
return
|
return cache[h]
|
||||||
}
|
}
|
||||||
this.fetching[h] = true
|
this.fetching[h] = true
|
||||||
|
|
||||||
@ -110,17 +110,16 @@ class ChainExplorer extends React.Component {
|
|||||||
await this.fetchN(h)
|
await this.fetchN(h)
|
||||||
}
|
}
|
||||||
|
|
||||||
const tofetch = Array(rows).fill(0).map((_, i) => top - i)
|
|
||||||
.filter(v => !this.state.cache[v])
|
|
||||||
|
|
||||||
let cache = {...this.state.cache}
|
let cache = {...this.state.cache}
|
||||||
let msgcache = {...this.state.messages}
|
let msgcache = {...this.state.messages}
|
||||||
|
|
||||||
await tofetch.reduce(async (prev, next) => {
|
console.log("top", top)
|
||||||
let prevts = await prev
|
|
||||||
let newts = await this.fetch(next, prevts, cache, msgcache)
|
let parent = cache[top]
|
||||||
return newts ? newts : prevts
|
for(let i = 0; i < rows; i++) {
|
||||||
}, Promise.resolve(cache[top]))
|
let newts = await this.fetch(top - i, parent, cache, msgcache)
|
||||||
|
parent = newts ? newts : parent
|
||||||
|
}
|
||||||
this.setState({cache: cache, messages: msgcache})
|
this.setState({cache: cache, messages: msgcache})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user