Open tariktokic opened 1 year ago
I'm having the same issue, is there any workaround for this?
Same problem here ... maybe a refresh() or redraw() method will be useful. thanks in advance.
To force the options to be rebuilt after disabling you can randomize wire:key to have Livewire rebuild:
<div wire:key="{{ 'x-select-year-' . rand() }}"
<x-select
:options="$listOfYears"
wire:model.lazy="year"
required
label="Year"
:disabled=$yearIsDisabled
/>
</div>
Describe the bug When using the
<x-select>
component and disabling and enabling it later again, all options from the:options
are gone.To Reproduce Steps to reproduce the behavior:
Create the component like this:
where the list of years is
$this->listOfYears = [(int)date('Y')-1, (int)date('Y'), (int)date('Y')+1];
and$this->yearIsDisabled=false
.Set
$this->yearIsDisabled=true
.Set
$this->yearIsDisabled=false
.Expected behavior After enabling the component I can select new options. Unfortunately they are all gone.
Dependencies
Desktop (If applicable, please complete the following information):