wire-elements / modal

Livewire component that provides you with a modal that supports multiple child modals while maintaining state.
MIT License
1.09k stars 129 forks source link

Uncaught TypeError: Cannot read properties of undefined (reading 'get') #428

Closed raonikhil closed 3 months ago

raonikhil commented 3 months ago

I'm trying to implement this into a Livewire 3 full page component but getting the below error in the console.

My full page component code:

<?php

namespace App\Livewire;

use Livewire\Attributes\Layout;
use Livewire\Component;

class LeadListing extends Component
{
    #[Layout('layouts.member')]
    public function render()
    {
        return view('lead.listing');
    }
}

My layout file:

<!DOCTYPE html>
<html>

    <head>
        <meta name="csrf-token" content="{{ csrf_token() }}">

        @vite(['resources/css/app.css', 'resources/js/app.js'])
    </head>

    <body>

        {{ $slot }}

    @livewire('wire-elements-modal')

    </body>

</html>

I'm not even trying to open the modal but merely adding @livewire('wire-elements-modal') to the layout file gives the error below.

Uncaught TypeError: Cannot read properties of undefined (reading 'get')
    at Proxy.getActiveComponentModalAttribute (leads:19:1045)
    at Proxy.init (leads:19:4037)
    at alpinejs.js?v=4bcc10cc:572:23
    at tryCatch (alpinejs.js?v=4bcc10cc:525:12)
    at evaluate (alpinejs.js?v=4bcc10cc:552:32)
    at Function.<anonymous> (alpinejs.js?v=4bcc10cc:2883:27)
    at flushHandlers (alpinejs.js?v=4bcc10cc:693:46)
    at stopDeferring (alpinejs.js?v=4bcc10cc:698:5)
    at deferHandlingDirectives (alpinejs.js?v=4bcc10cc:701:3)
    at initTree (alpinejs.js?v=4bcc10cc:196:3)

Any help would be appreciated.

image

raonikhil commented 3 months ago

This was due to alpinejs already being loaded in my app.js