Skip to content

Commit 3f81efb

Browse files
committed
Fixes wrong state context referenced in graph components
Resolves #4513
1 parent 08b26bc commit 3f81efb

File tree

2 files changed

+19
-20
lines changed

2 files changed

+19
-20
lines changed

src/webviews/apps/plus/graph/gate.ts

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import { consume } from '@lit/context';
2+
import { SignalWatcher } from '@lit-labs/signals';
23
import { css, html } from 'lit';
3-
import { customElement, state } from 'lit/decorators.js';
4+
import { customElement } from 'lit/decorators.js';
45
import { ifDefined } from 'lit/directives/if-defined.js';
56
import { createWebviewCommandLink } from '../../../../system/webview';
6-
import type { State } from '../../../plus/graph/protocol';
77
import { GlElement } from '../../shared/components/element';
88
import { linkStyles } from '../shared/components/vscode.css';
9-
import { stateContext } from './context';
9+
import { graphStateContext } from './stateProvider';
1010
import '../../shared/components/feature-badge';
1111
import '../../shared/components/feature-gate';
1212

1313
@customElement('gl-graph-gate')
14-
export class GlGraphGate extends GlElement {
14+
export class GlGraphGate extends SignalWatcher(GlElement) {
1515
static override styles = [
1616
linkStyles,
1717
css`
@@ -23,29 +23,28 @@ export class GlGraphGate extends GlElement {
2323
`,
2424
];
2525

26-
@consume({ context: stateContext, subscribe: true })
27-
@state()
28-
state!: State;
26+
@consume({ context: graphStateContext, subscribe: true })
27+
graphState!: typeof graphStateContext.__context__;
2928

3029
override render() {
3130
return html`<gl-feature-gate
32-
.featurePreview=${this.state.featurePreview}
31+
.featurePreview=${this.graphState.featurePreview}
3332
featurePreviewCommandLink=${ifDefined(
34-
this.state.featurePreview
33+
this.graphState.featurePreview
3534
? createWebviewCommandLink(
3635
'gitlens.plus.continueFeaturePreview',
37-
this.state.webviewId,
38-
this.state.webviewInstanceId,
39-
{ feature: this.state.featurePreview.feature },
36+
this.graphState.webviewId,
37+
this.graphState.webviewInstanceId,
38+
{ feature: this.graphState.featurePreview.feature },
4039
)
4140
: undefined,
4241
)}
4342
appearance="alert"
4443
featureWithArticleIfNeeded="the Commit Graph"
45-
?hidden=${this.state.allowed !== false}
44+
?hidden=${this.graphState.allowed !== false}
4645
.source=${{ source: 'graph', detail: 'gate' } as const}
47-
.state=${this.state.subscription?.state}
48-
.webroot=${this.state.webroot}
46+
.state=${this.graphState.subscription?.state}
47+
.webroot=${this.graphState.webroot}
4948
>
5049
<p slot="feature">
5150
<a href="https://help.gitkraken.com/gitlens/gitlens-features/#commit-graph-pro">Commit Graph</a>

src/webviews/apps/plus/graph/sidebar/sidebar.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import { consume } from '@lit/context';
22
import { Task } from '@lit/task';
3+
import { SignalWatcher } from '@lit-labs/signals';
34
import { css, html, LitElement, nothing } from 'lit';
45
import { customElement } from 'lit/decorators.js';
56
import { repeat } from 'lit/directives/repeat.js';
6-
import type { State } from '../../../../plus/graph/protocol';
77
import { DidChangeNotification, GetCountsRequest } from '../../../../plus/graph/protocol';
88
import { ipcContext } from '../../../shared/contexts/ipc';
99
import type { Disposable } from '../../../shared/events';
1010
import type { HostIpc } from '../../../shared/ipc';
1111
import { emitTelemetrySentEvent } from '../../../shared/telemetry';
12-
import { stateContext } from '../context';
12+
import { graphStateContext } from '../stateProvider';
1313
import '../../../shared/components/code-icon';
1414
import '../../../shared/components/overlays/tooltip';
1515

@@ -31,7 +31,7 @@ const icons: Icon[] = [
3131
type Counts = Record<IconTypes, number | undefined>;
3232

3333
@customElement('gl-graph-sidebar')
34-
export class GlGraphSideBar extends LitElement {
34+
export class GlGraphSideBar extends SignalWatcher(LitElement) {
3535
static override styles = css`
3636
.sidebar {
3737
box-sizing: border-box;
@@ -85,8 +85,8 @@ export class GlGraphSideBar extends LitElement {
8585
@consume({ context: ipcContext })
8686
private _ipc!: HostIpc;
8787

88-
@consume({ context: stateContext, subscribe: true })
89-
private readonly _state!: State;
88+
@consume({ context: graphStateContext, subscribe: true })
89+
private readonly _state!: typeof graphStateContext.__context__;
9090

9191
private _disposable: Disposable | undefined;
9292
private _countsTask = new Task(this, {

0 commit comments

Comments
 (0)