Skip to content

Commit 827dae6

Browse files
committed
Prevent "already disposed" errors when trying to kill disposed proxies
1 parent 9de6400 commit 827dae6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/protocol/src/browser/client.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,10 @@ export class Client {
174174
* Make a remote call for a proxy's method using proto.
175175
*/
176176
private remoteCall(proxyId: number | Module, method: string, args: any[]): Promise<any> {
177-
if (this.disconnected && typeof proxyId === "number") {
178-
// Can assume killing or closing works because a disconnected proxy
179-
// is disposed on the server's side.
177+
if (typeof proxyId === "number" && (this.disconnected || !this.proxies.has(proxyId))) {
178+
// Can assume killing or closing works because a disconnected proxy is
179+
// disposed on the server's side, and a non-existent proxy has already
180+
// been disposed.
180181
switch (method) {
181182
case "close":
182183
case "kill":

0 commit comments

Comments
 (0)