Skip to content

Commit

Permalink
Fix bug in subscribeBroadcastEvent method
Browse files Browse the repository at this point in the history
  • Loading branch information
gwbaik9717 committed Aug 21, 2024
1 parent 323f981 commit b692441
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/sdk/src/document/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ export class Document<T, P extends Indexable = Indexable> {
): Unsubscribe {
this.broadcastEventHandlers.set(topic, handler);

this.eventStream.subscribe((event) => {
const unsubscribe = this.eventStream.subscribe((event) => {
for (const docEvent of event) {
if (docEvent.type !== DocEventType.Broadcast) {
continue;
Expand All @@ -1074,6 +1074,7 @@ export class Document<T, P extends Indexable = Indexable> {
}, error);

return () => {
unsubscribe();
this.broadcastEventHandlers.delete(topic);
};
}
Expand Down

0 comments on commit b692441

Please sign in to comment.