Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jhob101's avatar

Alpine property not defined in Livewire component

Been staring at this for far too many hours now and can't work out why it's not working. The entire livewire component, slightly simplified is below:

Issue is the x-data="{isEditing: False}" is not 'seen' by the elements it contains resulting in the JS error:

livewire.js?id=df3a17f2:1123 Alpine Expression Error: isEditing is not defined

Expression: "isEditing"

 <div x-show=​"isEditing" x-transition style=​"display:​ none;​">​ ​</div>​

Any clue why this isn't working, as I'm fresh out of ideas. Seems such a basic case I can't figure out what's going wrong.

0 likes
3 replies
Snapey's avatar

check that you are NOT loading alpine.js in your layout file

1 like
jhob101's avatar

@Snapey Definitely not loaded in the main layout file. It's in a flux modal called from another flux modal. There is some alpine going on in the first modal.

Although I now think that the issue may stem from how I'm handling this inner modal, where the above code is from:

<flux:modal class="min-w-4xl" name="booking-form-modal" wire:model.self="showBookingFormModal" @close.self="resetForm">
        @if ($showBookingFormModal)
            @include('livewire.booking._form', ['assignment' => $assignment])
        @endif
    </flux:modal>

When this modal gets closed this error occurs:

livewire.js?id=df3a17f2:8564 Uncaught TypeError: Cannot read properties of null (reading 'before')
    at Block.appendChild (livewire.js?id=df3a17f2:8564:23)
    at patchChildren (livewire.js?id=df3a17f2:8385:21)
    at patchChildren (livewire.js?id=df3a17f2:8427:11)
    at patch (livewire.js?id=df3a17f2:8320:9)
    at patchChildren (livewire.js?id=df3a17f2:8476:9)
    at patch (livewire.js?id=df3a17f2:8320:9)
    at patchChildren (livewire.js?id=df3a17f2:8476:9)
    at patch (livewire.js?id=df3a17f2:8320:9)
    at patchChildren (livewire.js?id=df3a17f2:8476:9)
    at patch (livewire.js?id=df3a17f2:8320:9)

Which I think is probably due to the booking._form component getting removed from the DOM and causing issues with the DOM diffing.

Removing the @if($showBookingFormModal) causes another error, which is probably why it was there in the first place.

So I think my goal is now to work out a way to get rid of that condition, and then I expect that it will work again.

Please or to participate in this conversation.