check that you are NOT loading alpine.js in your layout file
Jun 1, 2025
3
Level 1
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:
<div class="overflow-x-auto">
<flux:table>
<flux:table.columns>
<flux:table.column>Description</flux:table.column>
<flux:table.column>Amount</flux:table.column>
<flux:table.column>Status</flux:table.column>
<flux:table.column class="flex justify-end"></flux:table.column>
</flux:table.columns>
<flux:table.rows>
<!-- Form row for adding new booking fee -->
<flux:table.row>
<livewire:booking-fee.form :key="'booking-fee-form-new'"/>
<flux:table.cell class="flex justify-end gap-1">
<flux:button type="button" size="sm" wire:click="$dispatchSelf('save')">
<x-font-awesome-icon :icon="Config('icons.add')"/>
</flux:button>
</flux:table.cell>
</flux:table.row>
<!-- Existing booking fees -->
@forelse ($booking_fees as $fee)
<flux:table.row :key="'booking-fee-row-'.$fee['id']">
<div x-data="{ isEditing: false }">
<div x-show="! isEditing">
<flux:table.cell colspan="4">
Print fields...
</flux:table.cell>
</div>
<div x-show="isEditing" x-transition>
<flux:table.cell colspan="4">
Show edit form
</flux:table.cell>
</div>
</div>
</flux:table.row>
@empty
<flux:table.row :key="'none'">
<flux:table.cell colspan="4">
No booking fees found. Add one above.
</flux:table.cell>
</flux:table.row>
@endforelse
</flux:table.rows>
</flux:table>
</div>
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.
Please or to participate in this conversation.