Closed rabol closed 2 weeks ago
I have created a Livewire component with this code and can't reproduce it. What settings do you have to enable these warnings?
<div>
@php
$users = App\Models\User::take(5)->get();
$headers = [
['key' => 'id', 'label' => '#'],
['key' => 'name', 'label' => 'Nice Name'],
];
@endphp
<x-table :headers="$headers" :rows="$users" striped @row-click="alert($event.detail.name)" />
</div>
<x-card>
<x-table :headers="$headers" :rows="$customerGroups" @row-click="$wire.showEdit($event.detail)" :sort-by="$sortBy" with-pagination>
@scope('actions', $customerGroup)
<x-button wire:click="delete('{{ $customerGroup->id }}')" icon="o-trash" class="btn-sm btn-ghost text-error" wire:confirm="Are you sure?" spinner />
@endscope
</x-table>
</x-card>
The reason is because we are exposing this variable to make access to $loop
on outside context. Although you don't use on your example it is always there.
I will hold for now, because I don't have a better solution. If someone could handle this I appreciate.
https://mary-ui.com/docs/components/table#loop-context
maryUI version
1.32
daisyUI version
4.11.1
Livewire version
3.5.0
What browsers are affected?
Chrome
What happened?
When using a Table component, the internal code have this:
That will cause a warning in php
[12:02:12] LOG.warning: Creation of dynamic property App\Livewire\CustomerGroups\Index::$loop is deprecated in /xxxx/xx/xx/xx/xx/storage/framework/views/91e4542c249e53580c8017a23412b26f.php on line 134
This occurs if you use the Table component in a normal Livewire component - the warning does not seems to appear in a Volt component