aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/src/xtext/XtextClient.ts
diff options
context:
space:
mode:
Diffstat (limited to 'subprojects/frontend/src/xtext/XtextClient.ts')
-rw-r--r--subprojects/frontend/src/xtext/XtextClient.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/subprojects/frontend/src/xtext/XtextClient.ts b/subprojects/frontend/src/xtext/XtextClient.ts
index 77980d35..4df4f57a 100644
--- a/subprojects/frontend/src/xtext/XtextClient.ts
+++ b/subprojects/frontend/src/xtext/XtextClient.ts
@@ -9,6 +9,7 @@ import type {
9 CompletionResult, 9 CompletionResult,
10} from '@codemirror/autocomplete'; 10} from '@codemirror/autocomplete';
11import type { Transaction } from '@codemirror/state'; 11import type { Transaction } from '@codemirror/state';
12import { type IReactionDisposer, reaction } from 'mobx';
12 13
13import type PWAStore from '../PWAStore'; 14import type PWAStore from '../PWAStore';
14import type EditorStore from '../editor/EditorStore'; 15import type EditorStore from '../editor/EditorStore';
@@ -43,6 +44,8 @@ export default class XtextClient {
43 44
44 private readonly modelGenerationService: ModelGenerationService; 45 private readonly modelGenerationService: ModelGenerationService;
45 46
47 private readonly keepAliveDisposer: IReactionDisposer;
48
46 constructor( 49 constructor(
47 private readonly store: EditorStore, 50 private readonly store: EditorStore,
48 private readonly pwaStore: PWAStore, 51 private readonly pwaStore: PWAStore,
@@ -65,6 +68,11 @@ export default class XtextClient {
65 store, 68 store,
66 this.updateService, 69 this.updateService,
67 ); 70 );
71 this.keepAliveDisposer = reaction(
72 () => store.generating,
73 (generating) => this.webSocketClient.setKeepAlive(generating),
74 { fireImmediately: true },
75 );
68 } 76 }
69 77
70 start(): void { 78 start(): void {
@@ -157,6 +165,7 @@ export default class XtextClient {
157 } 165 }
158 166
159 dispose(): void { 167 dispose(): void {
168 this.keepAliveDisposer();
160 this.webSocketClient.disconnect(); 169 this.webSocketClient.disconnect();
161 } 170 }
162} 171}