diff --git a/packages/sdk/src/client/attachment.ts b/packages/sdk/src/client/attachment.ts index b2ddbff2c..ef3ca3be3 100644 --- a/packages/sdk/src/client/attachment.ts +++ b/packages/sdk/src/client/attachment.ts @@ -112,6 +112,6 @@ export class Attachment { * `unsetClient` unsets the client of the document. */ public unsetClient(): void { - this.doc.setClient(null); + this.doc.setClient(); } } diff --git a/packages/sdk/src/document/document.ts b/packages/sdk/src/document/document.ts index 4e2944d1a..888f1a1ec 100644 --- a/packages/sdk/src/document/document.ts +++ b/packages/sdk/src/document/document.ts @@ -626,7 +626,7 @@ export class Document { DocEventCallbackMap

['broadcast'] >; - private client: Client | null = null; + private client?: Client; constructor(key: string, opts?: DocumentOptions) { this.opts = opts || {}; @@ -1333,12 +1333,12 @@ export class Document { return this.root.getGarbageLen(); } - /* + /** * `setClient` sets the client of this document. * * @internal */ - public setClient(client: Client | null): void { + public setClient(client?: Client): void { this.client = client; } @@ -2087,11 +2087,7 @@ export class Document { */ public broadcast(topic: string, payload: any): Promise { if (this.client) { - try { - return this.client.broadcast(this.getKey(), topic, payload); - } catch (e) { - throw e; - } + return this.client.broadcast(this.getKey(), topic, payload); } throw new YorkieError(