diff --git a/src/plus/webviews/graph/graphWebview.ts b/src/plus/webviews/graph/graphWebview.ts index 623f302..36590fc 100644 --- a/src/plus/webviews/graph/graphWebview.ts +++ b/src/plus/webviews/graph/graphWebview.ts @@ -189,7 +189,7 @@ export class GraphWebviewProvider implements WebviewProvider { this.resetRepositoryState(); this.ensureRepositorySubscriptions(true); - if (this.host.isReady) { + if (this.host.ready) { this.updateState(); } } @@ -282,7 +282,7 @@ export class GraphWebviewProvider implements WebviewProvider { this.repository = context.node.repo; } - if (this.repository != null && !loading && this.host.isReady) { + if (this.repository != null && !loading && this.host.ready) { this.updateState(); } } @@ -414,7 +414,7 @@ export class GraphWebviewProvider implements WebviewProvider { } if (visible) { - if (this.host.isReady) { + if (this.host.ready) { this.sendPendingIpcNotifications(); } @@ -1117,7 +1117,7 @@ export class GraphWebviewProvider implements WebviewProvider { @debug() private async notifyDidChangeWindowFocus(): Promise { - if (!this.host.isReady || !this.host.visible) { + if (!this.host.ready || !this.host.visible) { this.addPendingIpcNotification(DidChangeWindowFocusNotificationType); return false; } @@ -1181,7 +1181,7 @@ export class GraphWebviewProvider implements WebviewProvider { @debug() private async notifyDidChangeColumns() { - if (!this.host.isReady || !this.host.visible) { + if (!this.host.ready || !this.host.visible) { this.addPendingIpcNotification(DidChangeColumnsNotificationType); return false; } @@ -1196,7 +1196,7 @@ export class GraphWebviewProvider implements WebviewProvider { @debug() private async notifyDidChangeRefsVisibility() { - if (!this.host.isReady || !this.host.visible) { + if (!this.host.ready || !this.host.visible) { this.addPendingIpcNotification(DidChangeRefsVisibilityNotificationType); return false; } @@ -1210,7 +1210,7 @@ export class GraphWebviewProvider implements WebviewProvider { @debug() private async notifyDidChangeConfiguration() { - if (!this.host.isReady || !this.host.visible) { + if (!this.host.ready || !this.host.visible) { this.addPendingIpcNotification(DidChangeGraphConfigurationNotificationType); return false; } @@ -1222,7 +1222,7 @@ export class GraphWebviewProvider implements WebviewProvider { @debug() private async notifyDidFetch() { - if (!this.host.isReady || !this.host.visible) { + if (!this.host.ready || !this.host.visible) { this.addPendingIpcNotification(DidFetchNotificationType); return false; } @@ -1257,7 +1257,7 @@ export class GraphWebviewProvider implements WebviewProvider { @debug() private async notifyDidChangeWorkingTree() { - if (!this.host.isReady || !this.host.visible) { + if (!this.host.ready || !this.host.visible) { this.addPendingIpcNotification(DidChangeWorkingTreeNotificationType); return false; } @@ -1269,7 +1269,7 @@ export class GraphWebviewProvider implements WebviewProvider { @debug() private async notifyDidChangeSelection() { - if (!this.host.isReady || !this.host.visible) { + if (!this.host.ready || !this.host.visible) { this.addPendingIpcNotification(DidChangeSelectionNotificationType); return false; } @@ -1281,7 +1281,7 @@ export class GraphWebviewProvider implements WebviewProvider { @debug() private async notifyDidChangeSubscription() { - if (!this.host.isReady || !this.host.visible) { + if (!this.host.ready || !this.host.visible) { this.addPendingIpcNotification(DidChangeSubscriptionNotificationType); return false; } @@ -1295,7 +1295,7 @@ export class GraphWebviewProvider implements WebviewProvider { @debug() private async notifyDidChangeState() { - if (!this.host.isReady || !this.host.visible) { + if (!this.host.ready || !this.host.visible) { this.addPendingIpcNotification(DidChangeNotificationType); return false; } diff --git a/src/plus/webviews/timeline/timelineWebview.ts b/src/plus/webviews/timeline/timelineWebview.ts index 3a97c80..e3ed4ae 100644 --- a/src/plus/webviews/timeline/timelineWebview.ts +++ b/src/plus/webviews/timeline/timelineWebview.ts @@ -396,7 +396,7 @@ export class TimelineWebviewProvider implements WebviewProvider { @debug() private updateState(immediate: boolean = false) { - if (!this.host.isReady || !this.host.visible) return; + if (!this.host.ready || !this.host.visible) return; if (this._pendingContext == null && this.host.isView()) { this.updatePendingEditor(window.activeTextEditor); @@ -416,7 +416,7 @@ export class TimelineWebviewProvider implements WebviewProvider { @debug() private async notifyDidChangeState() { - if (!this.host.isReady || !this.host.visible) return false; + if (!this.host.ready || !this.host.visible) return false; this._notifyDidChangeStateDebounced?.cancel(); if (this._pendingContext == null) return false; diff --git a/src/webviews/commitDetails/commitDetailsWebview.ts b/src/webviews/commitDetails/commitDetailsWebview.ts index 8b5ce99..e209575 100644 --- a/src/webviews/commitDetails/commitDetailsWebview.ts +++ b/src/webviews/commitDetails/commitDetailsWebview.ts @@ -674,7 +674,7 @@ export class CommitDetailsWebviewProvider implements WebviewProvider void> | undefined = undefined; private updateState(immediate: boolean = false) { - if (!this.host.isReady || !this.host.visible) return; + if (!this.host.ready || !this.host.visible) return; if (immediate) { void this.notifyDidChangeState(); @@ -689,7 +689,7 @@ export class CommitDetailsWebviewProvider implements WebviewProvider { } private notifyDidChangeData(subscription?: Subscription) { - if (!this.host.isReady) return false; + if (!this.host.ready) return false; return window.withProgress({ location: { viewId: this.host.id } }, async () => { const sub = await this.getSubscription(subscription); @@ -255,7 +255,7 @@ export class HomeWebviewProvider implements WebviewProvider { } private notifyExtensionEnabled() { - if (!this.host.isReady) return; + if (!this.host.ready) return; void this.host.notify(DidChangeExtensionEnabledType, { extensionEnabled: this.getExtensionEnabled(), @@ -267,7 +267,7 @@ export class HomeWebviewProvider implements WebviewProvider { } private notifyDidChangeConfiguration() { - if (!this.host.isReady) return; + if (!this.host.ready) return; void this.host.notify(DidChangeConfigurationType, { plusEnabled: this.getPlusEnabled(), @@ -280,7 +280,7 @@ export class HomeWebviewProvider implements WebviewProvider { } private notifyDidChangeLayout() { - if (!this.host.isReady) return; + if (!this.host.ready) return; void this.host.notify(DidChangeLayoutType, { layout: this.getLayout() }); } diff --git a/src/webviews/settings/settingsWebview.ts b/src/webviews/settings/settingsWebview.ts index 487b1f9..c329633 100644 --- a/src/webviews/settings/settingsWebview.ts +++ b/src/webviews/settings/settingsWebview.ts @@ -16,7 +16,7 @@ export class SettingsWebviewProvider extends WebviewProviderWithConfigBase { const anchor = args[0]; if (anchor && typeof anchor === 'string') { - if (!loading && this.host.isReady && this.host.visible) { + if (!loading && this.host.ready && this.host.visible) { queueMicrotask( () => void this.host.notify(DidOpenAnchorNotificationType, { diff --git a/src/webviews/webviewController.ts b/src/webviews/webviewController.ts index 3cc71e7..6c6465c 100644 --- a/src/webviews/webviewController.ts +++ b/src/webviews/webviewController.ts @@ -123,10 +123,10 @@ export class WebviewController< public readonly id: Descriptor['id']; - private _isReady: boolean = false; + private _ready: boolean = false; private _suspended: boolean = false; - get isReady() { - return this._isReady; + get ready() { + return this._ready; } private readonly disposables: Disposable[] = []; @@ -171,7 +171,7 @@ export class WebviewController< this.provider.onFocusChanged?.(false); this.provider.onVisibilityChanged?.(false); - this._isReady = false; + this._ready = false; this._suspended = false; this._onDidDispose.fire(); @@ -271,7 +271,7 @@ export class WebviewController< this.provider.onRefresh?.(force); // Mark the webview as not ready, until we know if we are changing the html - this._isReady = false; + this._ready = false; this._suspended = false; const html = await this.getHtml(this.webview); @@ -282,7 +282,7 @@ export class WebviewController< // If we aren't changing the html, mark the webview as ready again if (this.webview.html === html) { - this._isReady = true; + this._ready = true; return; } @@ -302,7 +302,7 @@ export class WebviewController< switch (e.method) { case WebviewReadyCommandType.method: onIpc(WebviewReadyCommandType, e, () => { - this._isReady = true; + this._ready = true; this._suspended = false; this.provider.onReady?.(); }); @@ -349,12 +349,12 @@ export class WebviewController< if (this.descriptor.webviewHostOptions?.retainContextWhenHidden !== true) { if (visible) { if (this._suspended) { - this._isReady = true; + this._ready = true; this._suspended = false; this.provider.onReady?.(); } } else { - this._isReady = false; + this._ready = false; this._suspended = true; } } @@ -380,12 +380,12 @@ export class WebviewController< if (this.descriptor.webviewHostOptions?.retainContextWhenHidden !== true) { if (visible) { if (this._suspended) { - this._isReady = true; + this._ready = true; this._suspended = false; this.provider.onReady?.(); } } else { - this._isReady = false; + this._ready = false; this._suspended = true; } } @@ -476,7 +476,7 @@ export class WebviewController< }, }) async postMessage(message: IpcMessage): Promise { - if (!this._isReady) return Promise.resolve(false); + if (!this._ready) return Promise.resolve(false); // It looks like there is a bug where `postMessage` can sometimes just hang infinitely. Not sure why, but ensure we don't hang const success = await Promise.race([ diff --git a/src/webviews/webviewsController.ts b/src/webviews/webviewsController.ts index b710f1d..3090313 100644 --- a/src/webviews/webviewsController.ts +++ b/src/webviews/webviewsController.ts @@ -151,7 +151,7 @@ export class WebviewsController implements Disposable { return { id: descriptor.id, get ready() { - return registration.controller?.isReady ?? false; + return registration.controller?.ready ?? false; }, get visible() { return registration.controller?.visible ?? false; @@ -246,7 +246,7 @@ export class WebviewsController implements Disposable { return { id: descriptor.id, get ready() { - return registration.controller?.isReady ?? false; + return registration.controller?.ready ?? false; }, get visible() { return registration.controller?.visible ?? false;