Skip to content

Commit

Permalink
fix: sendQueriesState not async (#197)
Browse files Browse the repository at this point in the history
* fix: sendQueriesState not async

Signed-off-by: axel7083 <[email protected]>

* fix: prettier

Signed-off-by: axel7083 <[email protected]>

* fix: no any catch

Signed-off-by: axel7083 <[email protected]>

* fix: adding void return type

Signed-off-by: axel7083 <[email protected]>

---------

Signed-off-by: axel7083 <[email protected]>
  • Loading branch information
axel7083 authored Jan 30, 2024
1 parent fb786cb commit 3a9a284
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions packages/backend/src/managers/playground.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,7 @@ export class PlayGroundManager {
}
q.response = result as ModelResponse;
this.queries.set(query.id, q);
this.sendQueriesState().catch((err: unknown) => {
console.error('playground: unable to send the response to the frontend', err);
});
this.sendQueriesState();
}
});
});
Expand All @@ -226,7 +224,7 @@ export class PlayGroundManager {
post_req.end();

this.queries.set(query.id, query);
await this.sendQueriesState();
this.sendQueriesState();
return query.id;
}

Expand All @@ -241,10 +239,14 @@ export class PlayGroundManager {
return Array.from(this.playgrounds.values());
}

async sendQueriesState() {
await this.webview.postMessage({
id: MSG_NEW_PLAYGROUND_QUERIES_STATE,
body: this.getQueriesState(),
});
sendQueriesState(): void {
this.webview
.postMessage({
id: MSG_NEW_PLAYGROUND_QUERIES_STATE,
body: this.getQueriesState(),
})
.catch((err: unknown) => {
console.error(`Something went wrong while emitting MSG_NEW_PLAYGROUND_QUERIES_STATE: ${String(err)}`);
});
}
}

0 comments on commit 3a9a284

Please sign in to comment.