Skip to content

Commit 5391a48

Browse files
author
Eric Amodio
committed
Simplifies timeline paging options
1 parent 763516c commit 5391a48

5 files changed

Lines changed: 7 additions & 18 deletions

File tree

extensions/git/src/timelineProvider.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,8 @@ export class GitTimelineProvider implements TimelineProvider {
136136
// sortByAuthorDate: true
137137
});
138138

139-
const more = limit === undefined ? false : commits.length >= limit;
140139
const paging = commits.length ? {
141-
more: more,
142-
cursor: more ? commits[commits.length - 1]?.hash : undefined
140+
cursor: limit === undefined ? undefined : (commits.length >= limit ? commits[commits.length - 1]?.hash : undefined)
143141
} : undefined;
144142

145143
// If we asked for an extra commit, strip it off

src/vs/vscode.proposed.d.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1895,13 +1895,9 @@ declare module 'vscode' {
18951895
readonly paging?: {
18961896
/**
18971897
* A provider-defined cursor specifing the starting point of timeline items which are after the ones returned.
1898+
* Use `undefined` to signal that there are no more items to be returned.
18981899
*/
1899-
readonly cursor?: string
1900-
1901-
/**
1902-
* A flag which indicates whether there are more items that weren't returned.
1903-
*/
1904-
readonly more?: boolean;
1900+
readonly cursor: string | undefined;
19051901
}
19061902

19071903
/**

src/vs/workbench/contrib/timeline/browser/timelinePane.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ class TimelineAggregate {
8888
this.source = timeline.source;
8989
this.items = timeline.items;
9090
this._cursor = timeline.paging?.cursor;
91-
this._more = timeline.paging?.more ?? false;
9291
this.lastRenderedIndex = -1;
9392
}
9493

@@ -97,9 +96,8 @@ class TimelineAggregate {
9796
return this._cursor;
9897
}
9998

100-
private _more: boolean;
10199
get more(): boolean {
102-
return this._more;
100+
return this._cursor !== undefined;
103101
}
104102

105103
get newest(): TimelineItem | undefined {
@@ -150,7 +148,6 @@ class TimelineAggregate {
150148
}
151149

152150
this._cursor = timeline.paging?.cursor;
153-
this._more = timeline.paging?.more ?? false;
154151

155152
if (updated) {
156153
this.items.sort(

src/vs/workbench/contrib/timeline/common/timeline.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ export interface Timeline {
5454
items: TimelineItem[];
5555

5656
paging?: {
57-
cursor?: string
58-
more?: boolean;
57+
cursor: string | undefined;
5958
}
6059
}
6160

src/vs/workbench/contrib/timeline/common/timelineService.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ export class TimelineService implements ITimelineService {
5858
// }
5959
// ],
6060
// paging: {
61-
// cursor: 'next',
62-
// more: true
61+
// cursor: 'next'
6362
// }
6463
// });
6564
// }
@@ -84,7 +83,7 @@ export class TimelineService implements ITimelineService {
8483
// }
8584
// ],
8685
// paging: {
87-
// more: false
86+
// cursor: undefined
8887
// }
8988
// });
9089
// },

0 commit comments

Comments
 (0)