From c977d03692ac5a6d89d1e10677f5a5bc372cfd71 Mon Sep 17 00:00:00 2001 From: Alexander Zaytsev Date: Tue, 10 Mar 2026 11:45:37 +0100 Subject: [PATCH] Use `fire()` instead of `dispatch()` Addresses Copilot's feedback --- app/javascript/controllers/dispatch_event_controller.js | 4 ++-- app/views/account/settings/_cancellation.html.erb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/javascript/controllers/dispatch_event_controller.js b/app/javascript/controllers/dispatch_event_controller.js index 781b3c9ab..cf9192339 100644 --- a/app/javascript/controllers/dispatch_event_controller.js +++ b/app/javascript/controllers/dispatch_event_controller.js @@ -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 }) } } diff --git a/app/views/account/settings/_cancellation.html.erb b/app/views/account/settings/_cancellation.html.erb index 2733425e8..2e03da9be 100644 --- a/app/views/account/settings/_cancellation.html.erb +++ b/app/views/account/settings/_cancellation.html.erb @@ -23,7 +23,7 @@

Remember to export your data

- before you go. You won’t be able to do it after you cancel your account. + before you go. You won’t be able to do it after you cancel your account.