Use fire() instead of dispatch()

Addresses Copilot's feedback
This commit is contained in:
Alexander Zaytsev
2026-03-10 11:45:37 +01:00
parent 46943dc8c0
commit c977d03692
2 changed files with 3 additions and 3 deletions
@@ -3,7 +3,7 @@ import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static values = { name: String }
dispatch() {
document.dispatchEvent(new CustomEvent(this.nameValue, { bubbles: true }))
fire() {
this.dispatch(this.nameValue, { target: document, prefix: false })
}
}
@@ -23,7 +23,7 @@
<h3 class="margin-block-end-half txt-normal">Remember to export your data</h3>
<p class="margin-block-start-half margin-block-end">
<button type="button" class="btn btn--plain txt-link" data-controller="dispatch-event" data-dispatch-event-name-value="open-export" data-action="click->dialog#close click->dispatch-event#dispatch">Export your data</button> before you go. You wont be able to do it after you cancel your account.
<button type="button" class="btn btn--plain txt-link" data-controller="dispatch-event" data-dispatch-event-name-value="open-export" data-action="click->dialog#close click->dispatch-event#fire">Export your data</button> before you go. You wont be able to do it after you cancel your account.
</p>
</div>