VETO87's avatar
Level 2

Livewire Event Not Being Received in Filament 3 Page

I'm encountering an issue with event handling between a Laravel component and a Filament 3 page. I've set up an event dispatch in my component, but the Filament page isn't responding as expected. Here's my setup:

Laravel Component (in the resources folder):

<div x-data="chatwootIntegration()" x-init="init">
    <!-- UI elements can be added here if needed -->
</div>

<script>
function chatwootIntegration() {
    return {
        // ... other methods ...
        handleAppContextEvent(data) {
            if (data.contact && data.contact.phone_number) {
                const { code, number } = this.parsePhoneNumber(data.contact.phone_number);
                Livewire.dispatch('updatePhoneNumber', { code, number });
                console.log('Dispatched updatePhoneNumber event');
            } else {
                console.log('No contact phone number found in data');
            }
        },
        // ... other methods ...
    }
}
</script>

Filament 3 Page Blade:

<x-filament-panels::page>
    <x-chatwoot-integration />
    {{ $this->table }}
</x-filament-panels::page>

Filament 3 Page Class:

The event is being dispatched from the Laravel component, but it's not being received by the Filament page. I've added logging statements to verify if the updatePhoneNumber method is being called, but it doesn't seem to be triggering. Any suggestions on how to properly set up this event listening in Filament 3 would be greatly appreciated.

1 like
1 reply

Please or to participate in this conversation.