diff --git a/assets/js/app.js b/assets/js/app.js index d5639d0..da85cd4 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -47,3 +47,14 @@ liveSocket.connect() // >> liveSocket.disableLatencySim() window.liveSocket = liveSocket +// to init new Flowbite components if a page updated by navigation +window.addEventListener("phx:navigate", () => { + const delay = 100; + + setTimeout(() => { + window.dispatchEvent( + new Event("phx:page-loading-stop", { bubbles: true, cancelable: true }) + ); + }, delay); +}); +