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); }