Skip to content

Commit

Permalink
fix: Race condition in the workerManager (#3507)
Browse files Browse the repository at this point in the history
  • Loading branch information
bboure committed Jan 24, 2024
1 parent 253d76f commit 7f05c10
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/nice-cars-rush.md
@@ -0,0 +1,5 @@
---
'monaco-graphql': minor
---

Fix race condition in the worker Manager
4 changes: 2 additions & 2 deletions packages/monaco-graphql/src/workerManager.ts
Expand Up @@ -18,7 +18,7 @@ export class WorkerManager {
private _lastUsedTime = 0;
private _configChangeListener: IDisposable;
private _worker: editor.MonacoWebWorker<GraphQLWorker> | null = null;
private _client: GraphQLWorker | null = null;
private _client: Promise<GraphQLWorker> | null = null;

constructor(defaults: MonacoGraphQLAPI) {
this._defaults = defaults;
Expand Down Expand Up @@ -83,7 +83,7 @@ export class WorkerManager {
},
} as ICreateData,
});
this._client = await this._worker.getProxy();
this._client = this._worker.getProxy();
} catch (error) {
// eslint-disable-next-line no-console
console.error('error loading worker', error);
Expand Down

0 comments on commit 7f05c10

Please sign in to comment.