mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
Simplifies timeline paging options
This commit is contained in:
parent
763516c445
commit
5391a481bc
|
@ -136,10 +136,8 @@ export class GitTimelineProvider implements TimelineProvider {
|
|||
// sortByAuthorDate: true
|
||||
});
|
||||
|
||||
const more = limit === undefined ? false : commits.length >= limit;
|
||||
const paging = commits.length ? {
|
||||
more: more,
|
||||
cursor: more ? commits[commits.length - 1]?.hash : undefined
|
||||
cursor: limit === undefined ? undefined : (commits.length >= limit ? commits[commits.length - 1]?.hash : undefined)
|
||||
} : undefined;
|
||||
|
||||
// If we asked for an extra commit, strip it off
|
||||
|
|
8
src/vs/vscode.proposed.d.ts
vendored
8
src/vs/vscode.proposed.d.ts
vendored
|
@ -1895,13 +1895,9 @@ declare module 'vscode' {
|
|||
readonly paging?: {
|
||||
/**
|
||||
* A provider-defined cursor specifing the starting point of timeline items which are after the ones returned.
|
||||
* Use `undefined` to signal that there are no more items to be returned.
|
||||
*/
|
||||
readonly cursor?: string
|
||||
|
||||
/**
|
||||
* A flag which indicates whether there are more items that weren't returned.
|
||||
*/
|
||||
readonly more?: boolean;
|
||||
readonly cursor: string | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -88,7 +88,6 @@ class TimelineAggregate {
|
|||
this.source = timeline.source;
|
||||
this.items = timeline.items;
|
||||
this._cursor = timeline.paging?.cursor;
|
||||
this._more = timeline.paging?.more ?? false;
|
||||
this.lastRenderedIndex = -1;
|
||||
}
|
||||
|
||||
|
@ -97,9 +96,8 @@ class TimelineAggregate {
|
|||
return this._cursor;
|
||||
}
|
||||
|
||||
private _more: boolean;
|
||||
get more(): boolean {
|
||||
return this._more;
|
||||
return this._cursor !== undefined;
|
||||
}
|
||||
|
||||
get newest(): TimelineItem | undefined {
|
||||
|
@ -150,7 +148,6 @@ class TimelineAggregate {
|
|||
}
|
||||
|
||||
this._cursor = timeline.paging?.cursor;
|
||||
this._more = timeline.paging?.more ?? false;
|
||||
|
||||
if (updated) {
|
||||
this.items.sort(
|
||||
|
|
|
@ -54,8 +54,7 @@ export interface Timeline {
|
|||
items: TimelineItem[];
|
||||
|
||||
paging?: {
|
||||
cursor?: string
|
||||
more?: boolean;
|
||||
cursor: string | undefined;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -58,8 +58,7 @@ export class TimelineService implements ITimelineService {
|
|||
// }
|
||||
// ],
|
||||
// paging: {
|
||||
// cursor: 'next',
|
||||
// more: true
|
||||
// cursor: 'next'
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
@ -84,7 +83,7 @@ export class TimelineService implements ITimelineService {
|
|||
// }
|
||||
// ],
|
||||
// paging: {
|
||||
// more: false
|
||||
// cursor: undefined
|
||||
// }
|
||||
// });
|
||||
// },
|
||||
|
|
Loading…
Reference in a new issue