Fix explorer history refresh (#12443)
This commit is contained in:
@ -28,15 +28,23 @@ function combineFetched(
|
|||||||
current: ConfirmedSignatureInfo[] | undefined,
|
current: ConfirmedSignatureInfo[] | undefined,
|
||||||
before: TransactionSignature | undefined
|
before: TransactionSignature | undefined
|
||||||
) {
|
) {
|
||||||
if (current === undefined) {
|
if (current === undefined || current.length === 0) {
|
||||||
return fetched;
|
return fetched;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current.length > 0 && current[current.length - 1].signature === before) {
|
// History was refreshed, fetch results should be prepended if contiguous
|
||||||
return current.concat(fetched);
|
if (before === undefined) {
|
||||||
} else {
|
const end = fetched.findIndex((f) => f.signature === current[0].signature);
|
||||||
return fetched;
|
if (end < 0) return fetched;
|
||||||
|
return fetched.slice(0, end).concat(current);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// More history was loaded, fetch results should be appended
|
||||||
|
if (current[current.length - 1].signature === before) {
|
||||||
|
return current.concat(fetched);
|
||||||
|
}
|
||||||
|
|
||||||
|
return fetched;
|
||||||
}
|
}
|
||||||
|
|
||||||
function reconcile(
|
function reconcile(
|
||||||
|
Reference in New Issue
Block a user