Skip to content

Livewire.interceptMessage is not a function` error in Filament 5.1 with Livewire 4 #19070

Description

@theMelfix

Package

filament/filament

Package Version

5.1.0

Laravel Version

12.x

Livewire Version

v4.0.3

PHP Version

8.5

Problem description

 Uncaught TypeError: Livewire.interceptMessage is not a function at schemas.js?v=5.1.0.0:1:2067       

Cause:                                                                                                                            
 schemas.js calls Livewire.interceptMessage() which was a Livewire 3 API and does not exist in Livewire 4.                         
                                                                                                                                   
 Affected files:                                                                                                                   
 - filament/schemas/schemas.js                                                                                                     
 - filament/notifications/notifications.js                                                                                         
 - filament/support/support.js      

### Expected behavior

Filament 5.1 should work correctly with Livewire 4.0+ without JavaScript errors.                                                  
                                                                                                                                   
 Modal actions (Edit, Delete, Create) in tables and relation managers should open properly when clicked.                           
                                                                                                                                   
 The JavaScript assets should use Livewire 4 compatible APIs instead of deprecated Livewire 3 methods like `interceptMessage()`. 

### Steps to reproduce

 1. Create a new Laravel 12 project                                                                                                
 2. Install Filament 5.1:                                                                                                          
    ```bash                                                                                                                        
    composer require filament/filament:"^5.0"                                                                                      
    php artisan filament:install --panels                                                                                          
 3. Create any resource with a table:                                                                                              
 php artisan make:filament-resource Post --generate                                                                                
 4. Open browser console (F12) and navigate to the resource list page                                                              
 5. See error: Uncaught TypeError: Livewire.interceptMessage is not a function                                                     
 6. Try clicking Edit or Delete action on any row - modal does not open                                                            
                                                                                                                                   
 Minimal reproduction:                                                                                                             
 The error occurs immediately on any Filament page load because schemas.js executes:                                               
 Livewire.interceptMessage(({message: i, onSuccess: e}) => { ... })                                                                
                                                                                                                                   
 This method does not exist in Livewire 4.   

### Reproduction repository (issue will be closed if this is not valid)

https://github.com/theMelfix/filament-livewire4-bug/

### Relevant log output

```shell
support.js?v=5.1.0.0:25 Uncaught TypeError: Livewire.interceptMessage is not a function
   at HTMLDocument.<anonymous> (support.js?v=5.1.0.0:25:13898)
   at dispatch (livewire.js?id=0f6341c0:340:12)
   at Object.start2 [as start] (livewire.js?id=0f6341c0:8990:5)
   at HTMLDocument.<anonymous> (livewire.js?id=0f6341c0:10449:17)

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions