diff --git a/assets/js/phoenix_live_view/dom.js b/assets/js/phoenix_live_view/dom.js index 5e2b19579c..7ce90dc394 100644 --- a/assets/js/phoenix_live_view/dom.js +++ b/assets/js/phoenix_live_view/dom.js @@ -305,6 +305,10 @@ let DOM = { // when a container is updated const feedbackResults = {} feedbackContainers.forEach(el => { + // skip elements that are not in the DOM; + // this is needed because we push both fromEl and toEl in onBeforeElUpdated + // and it can happen that phx-feedback-for is removed from the toEl + if(!container.contains(el)) return const feedback = el.getAttribute(phxFeedbackFor) if(feedbackResults[feedback] === true){ this.hideFeedback(el)