From 96a6c34895762d18163d08098a347c9ff7fe634f Mon Sep 17 00:00:00 2001 From: KKlochko Date: Sat, 10 May 2025 22:06:44 +0300 Subject: [PATCH] Fix to init new Flowbite components to make them work. New cards' dropdown menus won't work, if the search query is updated. --- assets/js/app.js | 11 +++++++++++ 1 file changed, 11 insertions(+) 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); +}); +