mirror of
https://github.com/php-flasher/php-flasher.git
synced 2026-03-31 15:07:47 +01:00
Fix notification cleanup for Turbo and Livewire navigation
This commit is contained in:
@@ -122,6 +122,9 @@ final class HtmlPresenter implements PresenterInterface
|
|||||||
const addRenderListener = () => {
|
const addRenderListener = () => {
|
||||||
if (1 === document.querySelectorAll('script.flasher-js').length) {
|
if (1 === document.querySelectorAll('script.flasher-js').length) {
|
||||||
document.addEventListener('flasher:render', render);
|
document.addEventListener('flasher:render', render);
|
||||||
|
document.addEventListener('turbo:before-cache', () => {
|
||||||
|
document.querySelectorAll('.fl-wrapper').forEach(el => el.remove());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
{$livewireListener}
|
{$livewireListener}
|
||||||
@@ -145,7 +148,7 @@ final class HtmlPresenter implements PresenterInterface
|
|||||||
|
|
||||||
return <<<JAVASCRIPT
|
return <<<JAVASCRIPT
|
||||||
document.addEventListener('livewire:navigating', () => {
|
document.addEventListener('livewire:navigating', () => {
|
||||||
document.querySelectorAll('.fl-no-cache').forEach(el => el.remove());
|
document.querySelectorAll('.fl-wrapper').forEach(el => el.remove());
|
||||||
});
|
});
|
||||||
JAVASCRIPT;
|
JAVASCRIPT;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,6 +101,9 @@ final class HtmlPresenterTest extends TestCase
|
|||||||
const addRenderListener = () => {
|
const addRenderListener = () => {
|
||||||
if (1 === document.querySelectorAll('script.flasher-js').length) {
|
if (1 === document.querySelectorAll('script.flasher-js').length) {
|
||||||
document.addEventListener('flasher:render', render);
|
document.addEventListener('flasher:render', render);
|
||||||
|
document.addEventListener('turbo:before-cache', () => {
|
||||||
|
document.querySelectorAll('.fl-wrapper').forEach(el => el.remove());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
{$livewireListener}
|
{$livewireListener}
|
||||||
@@ -235,7 +238,7 @@ final class HtmlPresenterTest extends TestCase
|
|||||||
|
|
||||||
return <<<JAVASCRIPT
|
return <<<JAVASCRIPT
|
||||||
document.addEventListener('livewire:navigating', () => {
|
document.addEventListener('livewire:navigating', () => {
|
||||||
document.querySelectorAll('.fl-no-cache').forEach(el => el.remove());
|
document.querySelectorAll('.fl-wrapper').forEach(el => el.remove());
|
||||||
});
|
});
|
||||||
JAVASCRIPT;
|
JAVASCRIPT;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,6 +119,9 @@ final class ResponseManagerTest extends TestCase
|
|||||||
const addRenderListener = () => {
|
const addRenderListener = () => {
|
||||||
if (1 === document.querySelectorAll('script.flasher-js').length) {
|
if (1 === document.querySelectorAll('script.flasher-js').length) {
|
||||||
document.addEventListener('flasher:render', render);
|
document.addEventListener('flasher:render', render);
|
||||||
|
document.addEventListener('turbo:before-cache', () => {
|
||||||
|
document.querySelectorAll('.fl-wrapper').forEach(el => el.remove());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
{$livewireListener}
|
{$livewireListener}
|
||||||
@@ -162,7 +165,7 @@ final class ResponseManagerTest extends TestCase
|
|||||||
|
|
||||||
return <<<JAVASCRIPT
|
return <<<JAVASCRIPT
|
||||||
document.addEventListener('livewire:navigating', () => {
|
document.addEventListener('livewire:navigating', () => {
|
||||||
document.querySelectorAll('.fl-no-cache').forEach(el => el.remove());
|
document.querySelectorAll('.fl-wrapper').forEach(el => el.remove());
|
||||||
});
|
});
|
||||||
JAVASCRIPT;
|
JAVASCRIPT;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user