From e352dee1a314c62e4652806b2e3a4227094066df Mon Sep 17 00:00:00 2001 From: Paul Bob <69730720+Paul-Bob@users.noreply.github.com> Date: Wed, 21 Aug 2024 13:13:15 +0300 Subject: [PATCH] fix: temporary fix for turbo bug with lazy loading (#3160) --- app/javascript/avo.base.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/javascript/avo.base.js b/app/javascript/avo.base.js index 273253ef25..1eaba68529 100644 --- a/app/javascript/avo.base.js +++ b/app/javascript/avo.base.js @@ -82,6 +82,13 @@ document.addEventListener('turbo:load', () => { document.addEventListener('turbo:frame-load', () => { initTippy() + + // Handles turbo bug with lazy loading + // https://github.com/hotwired/turbo/issues/886 + // Remove when PR https://github.com/hotwired/turbo/pull/1227 is merged + document + .querySelectorAll('turbo-frame[loading="lazy"][complete]') + .forEach((frame) => frame.removeAttribute('loading')) }) document.addEventListener('turbo:before-fetch-response', async (e) => {