Cannot read property '$wire' of undefined

Trying out the new @entangle feature. I have the following markup: x-data="{open: @entangle('showResults')}" to handle a dropdown.

It actually works but I’m getting the following error in the console:

Uncaught TypeError: Cannot read property '$wire' of undefined
    at Livewire.value (index.js:29)

where index.js line 29 looks like:

find(componentId) {
        return this.components.componentsById[componentId].$wire

The same error occurs when I use $wire directly:

<h1 x-text="$wire.query"></h1>

So it looks like livewire using a component id that does not exist. Everyone else experiencing this?

Simple … alpine has been loaded before livewire.

1 Like

I have the same problem, but it began when I upgraded to Livewire 2 and Laravel 8.
I used TALL preset, so I’m not including Alpine by hand.
Any idea about how to fix it?

No sorry, never used the TALL preset. But I guess the problem is the same - alpine is loaded before livewire.

If you are using TALL Stack you are calling AlpineJS twice then,
make sure you’re calling @laravelStyles and @livewireScripts in the right way, and is there any error messages in the console or the network tab you can provide?

My livewire was loaded before my alpine script I just had to add defer to the js that has the apline.

<script src="{{ mix('assets/js/app.js') }}" defer></script>