diff --git a/app/assets/javascripts/widget.js b/app/assets/javascripts/widget.js index 2726ab5..fc45b5f 100644 --- a/app/assets/javascripts/widget.js +++ b/app/assets/javascripts/widget.js @@ -2336,6 +2336,11 @@ x.unload(), w.unload() }, + syncDestroy: function() { + x.unload(), + w.unload(), + R.unloadWidget() + }, isOpen: function() { return t.isOpened() }, diff --git a/app/javascript/src/freshdesk/chat_widget_setup.js b/app/javascript/src/freshdesk/chat_widget_setup.js index b0f9213..84a7dbd 100644 --- a/app/javascript/src/freshdesk/chat_widget_setup.js +++ b/app/javascript/src/freshdesk/chat_widget_setup.js @@ -62,7 +62,7 @@ function flushFreshchat() { // Navigating to another page document.addEventListener("turbolinks:visit", function() { if(window.fcWidget) { - window.fcWidget.destroy() + window.fcWidget.syncDestroy() } else { console.warn("No widget found!") }