Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
fix: call event of closing threads another name so it doesn't get cal…
Browse files Browse the repository at this point in the history
…led when dropdown closes
  • Loading branch information
Raspincel committed Feb 7, 2024
1 parent 6362584 commit d81cc19
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/components/comments/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export class Comments extends BaseComponent {
this.button?.addEventListener('toggle', this.togglePinActive);

// Comments component observers
this.element.addEventListener('close', this.closeThreads);
this.element.addEventListener('close-threads', this.closeThreads);
document.body.addEventListener('create-annotation', this.createAnnotation);
this.element.addEventListener('resolve-annotation', this.resolveAnnotation);
this.element.addEventListener('delete-annotation', this.deleteAnnotation);
Expand Down Expand Up @@ -221,8 +221,7 @@ export class Comments extends BaseComponent {
this.button?.removeEventListener('toggle', this.togglePinActive);

// Comments component observers
this.element.removeEventListener('close', this.closeThreads);
this.element.removeEventListener('create-annotation', this.createAnnotation);
this.element.removeEventListener('close-threads', this.closeThreads);
this.element.removeEventListener('resolve-annotation', this.resolveAnnotation);
this.element.removeEventListener('create-comment', ({ detail }: CustomEvent) => {
this.createComment(detail.uuid, detail.text, detail.mentions, true);
Expand All @@ -232,6 +231,7 @@ export class Comments extends BaseComponent {

// annotation observers
document.body.removeEventListener('select-annotation', this.onSelectAnnotation);
document.body.removeEventListener('create-annotation', this.createAnnotation);

// Realtime observers
this.realtime.commentsObserver.unsubscribe(this.onAnnotationListUpdate);
Expand Down
4 changes: 2 additions & 2 deletions src/web-components/comments/comments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class Comments extends WebComponentsBaseElement {
}

private close() {
this.emitEvent('close', {});
this.emitEvent('close-threads', {});
}

waterMarkStatus(waterMark: boolean) {
Expand Down Expand Up @@ -116,7 +116,7 @@ export class Comments extends WebComponentsBaseElement {
<div id="superviz-comments" class=${containerClass}>
<div class="header">
<superviz-comments-topbar
@close=${this.close}
@close-threads=${this.close}
side=${this.side.split(':')[0]}
></superviz-comments-topbar>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/web-components/comments/components/topbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class CommentsTopbar extends WebComponentsBase(LitElement) {
}

private close() {
this.dispatchEvent(new CustomEvent('close'));
this.dispatchEvent(new CustomEvent('close-threads'));
}

protected render() {
Expand Down

0 comments on commit d81cc19

Please sign in to comment.