Skip to content

Commit fb78274

Browse files
committed
Fixes "last page" issue on the graph
Adds additional logging
1 parent ab44227 commit fb78274

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

src/webviews/apps/plus/graph/graph.tsx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,28 @@ export class GraphApp extends App<State> {
108108
let previousRowsLength = previousRows.length;
109109
const newRowsLength = params.rows.length;
110110

111+
this.log(
112+
`${this.appName}.onMessageReceived(${msg.id}:${msg.method}): paging in ${newRowsLength} rows into existing ${previousRowsLength} rows at ${params.paging.startingCursor} (last existing row: ${lastSha})`,
113+
);
114+
111115
rows = [];
112116
// Preallocate the array to avoid reallocations
113117
rows.length = previousRowsLength + newRowsLength;
114118

115119
if (params.paging.startingCursor !== lastSha) {
120+
this.log(
121+
`${this.appName}.onMessageReceived(${msg.id}:${msg.method}): searching for ${params.paging.startingCursor} in existing rows`,
122+
);
123+
116124
let i = 0;
117125
let row;
118126
for (row of previousRows) {
119127
rows[i++] = row;
120128
if (row.sha === params.paging.startingCursor) {
129+
this.log(
130+
`${this.appName}.onMessageReceived(${msg.id}:${msg.method}): found ${params.paging.startingCursor} in existing rows`,
131+
);
132+
121133
previousRowsLength = i;
122134

123135
if (previousRowsLength !== previousRows.length) {
@@ -138,7 +150,16 @@ export class GraphApp extends App<State> {
138150
rows[previousRowsLength + i] = params.rows[i];
139151
}
140152
} else {
141-
rows = params.rows;
153+
this.log(
154+
`${this.appName}.onMessageReceived(${msg.id}:${msg.method}): setting to ${params.rows.length} rows`,
155+
);
156+
157+
if (params.rows.length === 0) {
158+
rows = this.state.rows;
159+
} else {
160+
// TODO@eamodio I'm not sure there is a case for this, but didn't wan't to remove it yet
161+
rows = params.rows;
162+
}
142163
}
143164

144165
this.setState({

0 commit comments

Comments
 (0)