Browse Source

Avoids use-before-init w/ useDefineForClassFields

See https://github.com/microsoft/TypeScript/issues/50971
main
Eric Amodio 1 year ago
committed by Ramin Tadayon
parent
commit
ec9da02ffa
No known key found for this signature in database GPG Key ID: 79D60DDE3DFB95F5
10 changed files with 31 additions and 10 deletions
  1. +3
    -1
      src/views/nodes/branchNode.ts
  2. +3
    -1
      src/views/nodes/branchTrackingStatusNode.ts
  3. +3
    -1
      src/views/nodes/contributorNode.ts
  4. +3
    -1
      src/views/nodes/fileHistoryNode.ts
  5. +3
    -1
      src/views/nodes/lineHistoryNode.ts
  6. +3
    -1
      src/views/nodes/reflogNode.ts
  7. +3
    -1
      src/views/nodes/reflogRecordNode.ts
  8. +4
    -1
      src/views/nodes/resultsCommitsNode.ts
  9. +3
    -1
      src/views/nodes/tagNode.ts
  10. +3
    -1
      src/views/nodes/worktreeNode.ts

+ 3
- 1
src/views/nodes/branchNode.ts View File

@ -38,6 +38,8 @@ type State = {
};
export class BranchNode extends ViewRefNode<ViewsWithBranches, GitBranchReference, State> implements PageableViewNode {
limit: number | undefined;
private readonly options: {
expanded: boolean;
limitCommits: boolean;
@ -73,6 +75,7 @@ export class BranchNode extends ViewRefNode
this.updateContext({ repository: repo, branch: branch, root: root });
this._uniqueId = getViewNodeId('branch', this.context);
this.limit = this.view.getNodeLastKnownLimit(this);
this.options = {
expanded: false,
@ -563,7 +566,6 @@ export class BranchNode extends ViewRefNode
return this._log?.hasMore ?? true;
}
limit: number | undefined = this.view.getNodeLastKnownLimit(this);
@gate()
async loadMore(limit?: number | { until?: any }) {
let log = await window.withProgress(

+ 3
- 1
src/views/nodes/branchTrackingStatusNode.ts View File

@ -27,6 +27,8 @@ export interface BranchTrackingStatus {
}
export class BranchTrackingStatusNode extends ViewNode<ViewsWithCommits> implements PageableViewNode {
limit: number | undefined;
constructor(
view: ViewsWithCommits,
protected override readonly parent: ViewNode,
@ -48,6 +50,7 @@ export class BranchTrackingStatusNode extends ViewNode impleme
root: root,
});
this._uniqueId = getViewNodeId('tracking-status', this.context);
this.limit = this.view.getNodeLastKnownLimit(this);
}
override get id(): string {
@ -284,7 +287,6 @@ export class BranchTrackingStatusNode extends ViewNode impleme
return this._log?.hasMore ?? true;
}
limit: number | undefined = this.view.getNodeLastKnownLimit(this);
@gate()
async loadMore(limit?: number | { until?: any }) {
let log = await window.withProgress(

+ 3
- 1
src/views/nodes/contributorNode.ts View File

@ -18,6 +18,8 @@ import type { PageableViewNode } from './viewNode';
import { ContextValues, getViewNodeId, ViewNode } from './viewNode';
export class ContributorNode extends ViewNode<ViewsWithContributors> implements PageableViewNode {
limit: number | undefined;
constructor(
uri: GitUri,
view: ViewsWithContributors,
@ -33,6 +35,7 @@ export class ContributorNode extends ViewNode implements
this.updateContext({ contributor: contributor });
this._uniqueId = getViewNodeId('contributor', this.context);
this.limit = this.view.getNodeLastKnownLimit(this);
}
override get id(): string {
@ -185,7 +188,6 @@ export class ContributorNode extends ViewNode implements
return this._log?.hasMore ?? true;
}
limit: number | undefined = this.view.getNodeLastKnownLimit(this);
@gate()
async loadMore(limit?: number | { until?: any }) {
let log = await window.withProgress(

+ 3
- 1
src/views/nodes/fileHistoryNode.ts View File

@ -22,6 +22,8 @@ import type { PageableViewNode, ViewNode } from './viewNode';
import { ContextValues, getViewNodeId, SubscribeableViewNode } from './viewNode';
export class FileHistoryNode extends SubscribeableViewNode<FileHistoryView> implements PageableViewNode {
limit: number | undefined;
protected override splatted = true;
constructor(
@ -37,6 +39,7 @@ export class FileHistoryNode extends SubscribeableViewNode impl
this.updateContext({ branch: branch });
}
this._uniqueId = getViewNodeId(`file-history+${uri.toString()}`, this.context);
this.limit = this.view.getNodeLastKnownLimit(this);
}
override get id(): string {
@ -250,7 +253,6 @@ export class FileHistoryNode extends SubscribeableViewNode impl
return this._log?.hasMore ?? true;
}
limit: number | undefined = this.view.getNodeLastKnownLimit(this);
@gate()
async loadMore(limit?: number | { until?: any }) {
let log = await window.withProgress(

+ 3
- 1
src/views/nodes/lineHistoryNode.ts View File

@ -26,6 +26,8 @@ export class LineHistoryNode
extends SubscribeableViewNode<FileHistoryView | LineHistoryView>
implements PageableViewNode
{
limit: number | undefined;
protected override splatted = true;
constructor(
@ -47,6 +49,7 @@ export class LineHistoryNode
},${selection.end.character}]`,
this.context,
);
this.limit = this.view.getNodeLastKnownLimit(this);
}
override get id(): string {
@ -263,7 +266,6 @@ export class LineHistoryNode
return this._log?.hasMore ?? true;
}
limit: number | undefined = this.view.getNodeLastKnownLimit(this);
@gate()
async loadMore(limit?: number | { until?: any }) {
let log = await window.withProgress(

+ 3
- 1
src/views/nodes/reflogNode.ts View File

@ -12,6 +12,8 @@ import type { PageableViewNode } from './viewNode';
import { ContextValues, getViewNodeId, ViewNode } from './viewNode';
export class ReflogNode extends ViewNode<RepositoriesView | WorkspacesView> implements PageableViewNode {
limit: number | undefined;
constructor(
uri: GitUri,
view: RepositoriesView | WorkspacesView,
@ -22,6 +24,7 @@ export class ReflogNode extends ViewNode impl
this.updateContext({ repository: repo });
this._uniqueId = getViewNodeId('reflog', this.context);
this.limit = this.view.getNodeLastKnownLimit(this);
}
override get id(): string {
@ -88,7 +91,6 @@ export class ReflogNode extends ViewNode impl
return this._reflog?.hasMore ?? true;
}
limit: number | undefined = this.view.getNodeLastKnownLimit(this);
async loadMore(limit?: number) {
let reflog = await this.getReflog();
if (reflog === undefined || !reflog.hasMore) return;

+ 3
- 1
src/views/nodes/reflogRecordNode.ts View File

@ -13,11 +13,14 @@ import type { PageableViewNode } from './viewNode';
import { ContextValues, getViewNodeId, ViewNode } from './viewNode';
export class ReflogRecordNode extends ViewNode<ViewsWithCommits> implements PageableViewNode {
limit: number | undefined;
constructor(view: ViewsWithCommits, parent: ViewNode, public readonly record: GitReflogRecord) {
super(GitUri.fromRepoPath(record.repoPath), view, parent);
this.updateContext({ reflog: record });
this._uniqueId = getViewNodeId('reflog-record', this.context);
this.limit = this.view.getNodeLastKnownLimit(this);
}
override get id(): string {
@ -86,7 +89,6 @@ export class ReflogRecordNode extends ViewNode implements Page
return this._log?.hasMore ?? true;
}
limit: number | undefined = this.view.getNodeLastKnownLimit(this);
@gate()
async loadMore(limit?: number | { until?: any }) {
let log = await window.withProgress(

+ 4
- 1
src/views/nodes/resultsCommitsNode.ts View File

@ -29,6 +29,8 @@ export class ResultsCommitsNode
extends ViewNode<View>
implements PageableViewNode
{
limit: number | undefined;
constructor(
view: View,
protected override readonly parent: ViewNode,
@ -55,6 +57,8 @@ export class ResultsCommitsNode
super(GitUri.fromRepoPath(repoPath), view, parent);
this._uniqueId = getViewNodeId(`results-commits${_options?.id ? `+${_options.id}` : ''}`, this.context);
this.limit = this.view.getNodeLastKnownLimit(this);
this._options = { expand: true, ..._options };
if (splatted != null) {
this.splatted = splatted;
@ -195,7 +199,6 @@ export class ResultsCommitsNode
}
private _expandAutolinks: boolean = false;
limit: number | undefined = this.view.getNodeLastKnownLimit(this);
async loadMore(limit?: number, context?: Record<string, unknown>): Promise<void> {
const results = await this.getCommitsQueryResults();
if (results == null || !results.hasMore) return;

+ 3
- 1
src/views/nodes/tagNode.ts View File

@ -19,11 +19,14 @@ import type { PageableViewNode, ViewNode } from './viewNode';
import { ContextValues, getViewNodeId, ViewRefNode } from './viewNode';
export class TagNode extends ViewRefNode<ViewsWithTags, GitTagReference> implements PageableViewNode {
limit: number | undefined;
constructor(uri: GitUri, view: ViewsWithTags, public override parent: ViewNode, public readonly tag: GitTag) {
super(uri, view, parent);
this.updateContext({ tag: tag });
this._uniqueId = getViewNodeId('tag', this.context);
this.limit = this.view.getNodeLastKnownLimit(this);
}
override get id(): string {
@ -118,7 +121,6 @@ export class TagNode extends ViewRefNode impleme
return this._log?.hasMore ?? true;
}
limit: number | undefined = this.view.getNodeLastKnownLimit(this);
@gate()
async loadMore(limit?: number | { until?: any }) {
let log = await window.withProgress(

+ 3
- 1
src/views/nodes/worktreeNode.ts View File

@ -30,6 +30,8 @@ type State = {
};
export class WorktreeNode extends ViewNode<ViewsWithWorktrees, State> {
limit: number | undefined;
private _branch: GitBranch | undefined;
constructor(
@ -42,6 +44,7 @@ export class WorktreeNode extends ViewNode {
this.updateContext({ worktree: worktree });
this._uniqueId = getViewNodeId('worktree', this.context);
this.limit = this.view.getNodeLastKnownLimit(this);
}
override get id(): string {
@ -397,7 +400,6 @@ export class WorktreeNode extends ViewNode {
return this._log?.hasMore ?? true;
}
limit: number | undefined = this.view.getNodeLastKnownLimit(this);
@gate()
async loadMore(limit?: number | { until?: any }) {
let log = await window.withProgress(

||||||
x
 
000:0
Loading…
Cancel
Save