diff --git a/src/Prime/Response/Presenter/HtmlPresenter.php b/src/Prime/Response/Presenter/HtmlPresenter.php index fd630f4b..930426f9 100644 --- a/src/Prime/Response/Presenter/HtmlPresenter.php +++ b/src/Prime/Response/Presenter/HtmlPresenter.php @@ -122,6 +122,9 @@ final class HtmlPresenter implements PresenterInterface const addRenderListener = () => { if (1 === document.querySelectorAll('script.flasher-js').length) { document.addEventListener('flasher:render', render); + document.addEventListener('turbo:before-cache', () => { + document.querySelectorAll('.fl-wrapper').forEach(el => el.remove()); + }); } {$livewireListener} @@ -145,7 +148,7 @@ final class HtmlPresenter implements PresenterInterface return << { - document.querySelectorAll('.fl-no-cache').forEach(el => el.remove()); + document.querySelectorAll('.fl-wrapper').forEach(el => el.remove()); }); JAVASCRIPT; } diff --git a/tests/Prime/Response/Presenter/HtmlPresenterTest.php b/tests/Prime/Response/Presenter/HtmlPresenterTest.php index be24ad87..91fa6283 100644 --- a/tests/Prime/Response/Presenter/HtmlPresenterTest.php +++ b/tests/Prime/Response/Presenter/HtmlPresenterTest.php @@ -101,6 +101,9 @@ final class HtmlPresenterTest extends TestCase const addRenderListener = () => { if (1 === document.querySelectorAll('script.flasher-js').length) { document.addEventListener('flasher:render', render); + document.addEventListener('turbo:before-cache', () => { + document.querySelectorAll('.fl-wrapper').forEach(el => el.remove()); + }); } {$livewireListener} @@ -235,7 +238,7 @@ final class HtmlPresenterTest extends TestCase return << { - document.querySelectorAll('.fl-no-cache').forEach(el => el.remove()); + document.querySelectorAll('.fl-wrapper').forEach(el => el.remove()); }); JAVASCRIPT; } diff --git a/tests/Prime/Response/ResponseManagerTest.php b/tests/Prime/Response/ResponseManagerTest.php index 869fc4ef..e6c8cd72 100644 --- a/tests/Prime/Response/ResponseManagerTest.php +++ b/tests/Prime/Response/ResponseManagerTest.php @@ -119,6 +119,9 @@ final class ResponseManagerTest extends TestCase const addRenderListener = () => { if (1 === document.querySelectorAll('script.flasher-js').length) { document.addEventListener('flasher:render', render); + document.addEventListener('turbo:before-cache', () => { + document.querySelectorAll('.fl-wrapper').forEach(el => el.remove()); + }); } {$livewireListener} @@ -162,7 +165,7 @@ final class ResponseManagerTest extends TestCase return << { - document.querySelectorAll('.fl-no-cache').forEach(el => el.remove()); + document.querySelectorAll('.fl-wrapper').forEach(el => el.remove()); }); JAVASCRIPT; }