Bladeren bron

Fixes issues where paging can get stuck

Handles timeout of pending completion calls
main
Eric Amodio 2 jaren geleden
bovenliggende
commit
785048d14d
3 gewijzigde bestanden met toevoegingen van 27 en 19 verwijderingen
  1. +4
    -4
      src/env/node/git/localGitProvider.ts
  2. +2
    -2
      src/webviews/apps/plus/graph/GraphWrapper.tsx
  3. +21
    -13
      src/webviews/apps/plus/graph/graph.tsx

+ 4
- 4
src/env/node/git/localGitProvider.ts Bestand weergeven

@ -1838,12 +1838,12 @@ export class LocalGitProvider implements GitProvider, Disposable {
});
}
const last = rows[rows.length - 1];
const startingCursor = cursor?.sha;
const lastSha = last(ids);
cursor =
last != null
lastSha != null
? {
sha: last.sha,
sha: lastSha,
skip: total - iterations,
}
: undefined;
@ -1858,7 +1858,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
paging: {
limit: limit === 0 ? count : limit,
startingCursor: startingCursor,
hasMore: count > limit,
hasMore: limit !== 0 && count > limit,
},
more: async (limit: number, sha?: string): Promise<GitGraph | undefined> =>
getCommitsForGraphCore.call(this, limit, sha, cursor),

+ 2
- 2
src/webviews/apps/plus/graph/GraphWrapper.tsx Bestand weergeven

@ -43,10 +43,10 @@ export interface GraphWrapperProps extends State {
onSearchCommitsPromise?: (
search: SearchQuery,
options?: { limit?: number; more?: boolean },
) => Promise<DidSearchCommitsParams>;
) => Promise<DidSearchCommitsParams | undefined>;
onDismissBanner?: (key: DismissBannerParams['key']) => void;
onSelectionChange?: (selection: { id: string; type: GitGraphRowType }[]) => void;
onEnsureCommitPromise?: (id: string, select: boolean) => Promise<DidEnsureCommitParams>;
onEnsureCommitPromise?: (id: string, select: boolean) => Promise<DidEnsureCommitParams | undefined>;
}
const getStyleProps = (

+ 21
- 13
src/webviews/apps/plus/graph/graph.tsx Bestand weergeven

@ -119,7 +119,7 @@ export class GraphApp extends App {
case DidChangeCommitsNotificationType.method:
onIpc(DidChangeCommitsNotificationType, msg, params => {
let rows;
if (params?.paging?.startingCursor != null && this.state.rows != null) {
if (params.rows.length && params.paging?.startingCursor != null && this.state.rows != null) {
const previousRows = this.state.rows;
const lastSha = previousRows[previousRows.length - 1]?.sha;
@ -306,20 +306,28 @@ export class GraphApp extends App {
return this.sendCommand(SearchCommitsCommandType, { search: search, limit: options?.limit });
}
private onSearchCommitsPromise(search: SearchQuery, options?: { limit?: number; more?: boolean }) {
return this.sendCommandWithCompletion(
SearchCommitsCommandType,
{ search: search, limit: options?.limit, more: options?.more },
DidSearchCommitsNotificationType,
);
private async onSearchCommitsPromise(search: SearchQuery, options?: { limit?: number; more?: boolean }) {
try {
return await this.sendCommandWithCompletion(
SearchCommitsCommandType,
{ search: search, limit: options?.limit, more: options?.more },
DidSearchCommitsNotificationType,
);
} catch {
return undefined;
}
}
private onEnsureCommitPromise(id: string, select: boolean) {
return this.sendCommandWithCompletion(
EnsureCommitCommandType,
{ id: id, select: select },
DidEnsureCommitNotificationType,
);
private async onEnsureCommitPromise(id: string, select: boolean) {
try {
return await this.sendCommandWithCompletion(
EnsureCommitCommandType,
{ id: id, select: select },
DidEnsureCommitNotificationType,
);
} catch {
return undefined;
}
}
private onSelectionChanged(selection: { id: string; type: GitGraphRowType }[]) {

Laden…
Annuleren
Opslaan