fix(livewire): resolve Echo not found error due to lazy loading timing

This commit is contained in:
idevakk
2026-03-05 15:54:50 +05:30
parent bfc2662efb
commit 62d8f15919
2 changed files with 4 additions and 7 deletions

View File

@@ -3,9 +3,7 @@ import Echo from 'laravel-echo';
import Pusher from 'pusher-js';
window.Pusher = Pusher;
window.startReverb = function () {
if (window.Echo) return window.Echo;
if (document.querySelector('[data-requires-reverb]')) {
window.Echo = new Echo({
broadcaster: 'reverb',
key: import.meta.env.VITE_REVERB_APP_KEY,
@@ -15,6 +13,4 @@ window.startReverb = function () {
forceTLS: (import.meta.env.VITE_REVERB_SCHEME ?? 'https') === 'https',
enabledTransports: ['ws', 'wss'],
});
return window.Echo;
};
}