From 80186df03f9cd99f86d0ab63bbfde056b0b034b5 Mon Sep 17 00:00:00 2001 From: Nathan Hopkins Date: Sat, 5 Oct 2019 09:30:52 -0600 Subject: [PATCH] Prevent duplicate lifecycle invocations --- javascript/stimulus_reflex.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/javascript/stimulus_reflex.js b/javascript/stimulus_reflex.js index c0441893..cc491d39 100644 --- a/javascript/stimulus_reflex.js +++ b/javascript/stimulus_reflex.js @@ -134,9 +134,9 @@ const invokeLifecycleMethod = (stage, reflex, element) => { const reflexController = findReflexController(element, reflex) // find reflex controllers wired on this element - const controllers = localReflexControllers(element) + const controllers = new Set(localReflexControllers(element)) - if (reflexController) controllers.push(reflexController) + if (reflexController) controllers.add(reflexController) if (controllers.length === 0) return controllers.forEach(controller => {