From 62549e673901baf41271c29b35f5ed54f0777f6c Mon Sep 17 00:00:00 2001 From: Martin Lopez Date: Thu, 3 Oct 2024 19:57:33 -0300 Subject: [PATCH] fix: ensure that footer replacing js is always executed on attach --- .../vaadin/addons/chatassistant/ChatAssistant.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/flowingcode/vaadin/addons/chatassistant/ChatAssistant.java b/src/main/java/com/flowingcode/vaadin/addons/chatassistant/ChatAssistant.java index 365bf6f..21ce47a 100644 --- a/src/main/java/com/flowingcode/vaadin/addons/chatassistant/ChatAssistant.java +++ b/src/main/java/com/flowingcode/vaadin/addons/chatassistant/ChatAssistant.java @@ -290,11 +290,10 @@ public Component getHeaderComponent() { */ public void setFooterComponent(Component component) { Objects.requireNonNull(component, "Component cannot not be null"); - if (footerComponent==null) { - this.getElement().executeJs("setTimeout(() => this.shadowRoot.querySelector($0).innerHTML = $1)", ".chat-footer", ""); - } else { + if (footerComponent!=null) { this.footerContainer.remove(footerComponent); } + this.getElement().executeJs("setTimeout(() => this.shadowRoot.querySelector($0).innerHTML = $1)", ".chat-footer", ""); this.footerComponent = component; footerContainer.add(footerComponent); }