PR feedback

This commit is contained in:
Jay Ohms
2026-02-26 07:53:02 -05:00
parent 84c650ab25
commit 7427675fc8
4 changed files with 10 additions and 1 deletions
@@ -6,6 +6,8 @@ export default class extends BridgeComponent {
static targets = [ "button" ]
connect() {
super.connect()
if (!this.beforeUnloadHandler) {
this.beforeUnloadHandler = this.handleBeforeUnload.bind(this)
}
@@ -14,6 +16,8 @@ export default class extends BridgeComponent {
}
disconnect() {
super.disconnect()
if (this.beforeUnloadHandler) {
window.removeEventListener("beforeunload", this.beforeUnloadHandler)
}