Bläddra i källkod

Fixes "last page" issue on the graph

Adds additional logging
main
Eric Amodio 2 år sedan
förälder
incheckning
fb78274fb8
1 ändrade filer med 22 tillägg och 1 borttagningar
  1. +22
    -1
      src/webviews/apps/plus/graph/graph.tsx

+ 22
- 1
src/webviews/apps/plus/graph/graph.tsx Visa fil

@ -108,16 +108,28 @@ export class GraphApp extends App {
let previousRowsLength = previousRows.length;
const newRowsLength = params.rows.length;
this.log(
`${this.appName}.onMessageReceived(${msg.id}:${msg.method}): paging in ${newRowsLength} rows into existing ${previousRowsLength} rows at ${params.paging.startingCursor} (last existing row: ${lastSha})`,
);
rows = [];
// Preallocate the array to avoid reallocations
rows.length = previousRowsLength + newRowsLength;
if (params.paging.startingCursor !== lastSha) {
this.log(
`${this.appName}.onMessageReceived(${msg.id}:${msg.method}): searching for ${params.paging.startingCursor} in existing rows`,
);
let i = 0;
let row;
for (row of previousRows) {
rows[i++] = row;
if (row.sha === params.paging.startingCursor) {
this.log(
`${this.appName}.onMessageReceived(${msg.id}:${msg.method}): found ${params.paging.startingCursor} in existing rows`,
);
previousRowsLength = i;
if (previousRowsLength !== previousRows.length) {
@ -138,7 +150,16 @@ export class GraphApp extends App {
rows[previousRowsLength + i] = params.rows[i];
}
} else {
rows = params.rows;
this.log(
`${this.appName}.onMessageReceived(${msg.id}:${msg.method}): setting to ${params.rows.length} rows`,
);
if (params.rows.length === 0) {
rows = this.state.rows;
} else {
// TODO@eamodio I'm not sure there is a case for this, but didn't wan't to remove it yet
rows = params.rows;
}
}
this.setState({

Laddar…
Avbryt
Spara