From 24e6a33f07c6157f1f3ee7d7eca90c26d3491600 Mon Sep 17 00:00:00 2001 From: aaaaargZombies Date: Tue, 30 Aug 2022 12:23:31 +0100 Subject: [PATCH] add a disconnect method to opening_times_controller --- app/javascript/controllers/opening_times_controller.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/javascript/controllers/opening_times_controller.js b/app/javascript/controllers/opening_times_controller.js index 115597d2b..9ce435006 100644 --- a/app/javascript/controllers/opening_times_controller.js +++ b/app/javascript/controllers/opening_times_controller.js @@ -74,6 +74,12 @@ export default class extends Controller { this.resetForm(); } + disconnect() { + // clear nodes & eventListeners which don't have stimulus attributes + // This might be unnecessary + this.listTarget.replaceChildren(); + } + resetForm(day = "Monday", open = "00:00", close = "00:00") { const allDay = open === "00:00" && close === "23:59"; this.dayTarget.value = day;