Stimulus Discourse

Controller called twice

Hello,

Newbie here trying to solve a problem. I see a similar question has been asked; however mine is a bit different as I’m not using Turbolinks. My controller is causing two events when I create ‘tag’. Any advice would be great.

comments-container{ “data-controller”: “comments”}
%h3.short.pull-left
= current_tenant.label_for_field(:comment).try(:pluralize)
.button-group.action-bar
%a.fa.fa-cloud-download.export-comments-btn{ title: “Export” }
%a.fa.fa-archive.archive-toggle-btn{ title: “View Comments Archives” }
.comment-form
%form
.form-group
%textarea.form-control{ name: “Content” , “data-target”: “comments.content” }
.tag-inputs
%span.help-block
Enter a tag followed by the tab, enter, comma or semi-colon key
%span
%label.tags-input-label
Tags:
%div{ “data-target”: “comments.tagsContainer” }
%input.tags-input-input{ type: “text” , “data-action”: “keydown->comments#createTag” }
.tag-inputs
%span
%label.tags-input-label
Users to notify:
%select{ type: “select” , “data-action”: “comments#notifiedUsers”}
= options_for_select(current_tenant.users.order(email: :asc).pluck(:email, :id).unshift([“Please Select a User”,nil]))
%button.btn.btn-info{ type: “submit” , “data-action”: “comments#submit”}
= “Post #{current_tenant.label_for_field(:comment)}”
.comment-search
%input.search{ placeholder: “Search Comments” }
.comments-items
= render @comments