livewire / flux

The official Livewire UI component library
https://fluxui.dev
472 stars 39 forks source link

Select + Variant (listbox) -> Not Defaulting Back to Selected Value on Form Validation #60

Closed WorthLMS closed 1 month ago

WorthLMS commented 1 month ago

Replication:

Created a flux:select with a couple of sample options from using the listbox variant. wire:model the flux:select

triggered validation error on another field (component refreshes)...

Selected Value of select is gone.

flux:input values remain, but flux:select with variant listbox resets to null

WorthLMS commented 1 month ago

Confirmed Findings.

Removed Searchable (Issue Remained) Removed variant="listbox" (normal select), value was retained after validation error Replaced variant="listbox" value was NOT retained after validation error

gaiustemple commented 1 month ago

Also having this issue on an edit page with a "listbox" variant select, which tries to load the previously saved value into the select - but just shows blank.

patrykszady commented 1 month ago

Similar with variant="combobox"

jsandfordhughescoop commented 1 month ago

Same thing happening here with anything but the default variant

patrykszady commented 1 month ago

Hi, so when I use the combobox select my pre-selected value does not populate like it does on a regular select. Can anyone replicate this?

<flux:select label="Vendor" wire:model.live="form.vendor_id" variant="combobox" placeholder="Choose vendor...">
            @foreach($vendors as $vendor)
                <flux:option>{{$vendor->name}}</flux:option>
            @endforeach
        </flux:select>
jsandfordhughescoop commented 1 month ago

Hi, so when I use the combobox select my pre-selected value does not populate like it does on a regular select. Can anyone replicate this?

<flux:select label="Vendor" wire:model.live="form.vendor_id" variant="combobox" placeholder="Choose vendor...">
            @foreach($vendors as $vendor)
                <flux:option>{{$vendor->name}}</flux:option>
            @endforeach
        </flux:select>

Yes this is an issue at the moment

patrykszady commented 1 month ago

Caleb on issue #60: “ Thank you for the report. This issue has been fixed and will be available in the next release.”

Please close this once confirmed fixed in 1.0.8

calebporzio commented 1 month ago

This should be fixed, however, if it is not, please re-submit with a copy/pastable example.