filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
19.21k stars 2.96k forks source link

Searchable select in repeater #956

Closed lolen closed 2 years ago

lolen commented 2 years ago

Package

filament/filament

Package Version

v2.5.24

Laravel Version

v8.76.1

Livewire Version

v2.8.2

PHP Version

PHP 8.0.13

Bug description

When we use the searchable() option for select in the repeater we get an error in the console when deleting.

image

Steps to reproduce

Forms\Components\Repeater::make('users')->schema([
    Forms\Components\Select::make('user_id')
        ->label('Model')
        ->options(User::query()->get()->pluck('name', 'id')->toArray())
        ->searchable()
        ->required()
])

Relevant log output

SupportAlpine.js:53 Uncaught (in promise) TypeError: Cannot read properties of null (reading '__livewire')
    at SupportAlpine.js:53
    at Object.get (module.esm.js:1631)
    at Object.get (module.esm.js:1544)
    at getOptionLabelUsing (eval at <anonymous> (module.esm.js:1697), <anonymous>:5:21)
    at module.esm.js:19152
    at c (runtime.js:63)
    at Generator._invoke (runtime.js:294)
    at Generator.next (runtime.js:119)
    at Fu (app.js?id=c5560e02fb2bba583435:8)
    at a (app.js?id=c5560e02fb2bba583435:8)SupportAlpine.js:53 Uncaught (in promise) TypeError: Cannot read properties of null (reading '__livewire')
    at SupportAlpine.js:53
    at Object.get (module.esm.js:1631)
    at Object.get (module.esm.js:1544)
    at getOptionLabelUsing (eval at <anonymous> (module.esm.js:1697), <anonymous>:5:21)
    at module.esm.js:19152
    at c (runtime.js:63)
    at Generator._invoke (runtime.js:294)
    at Generator.next (runtime.js:119)
    at Fu (app.js?id=c5560e02fb2bba583435:8)
    at a (app.js?id=c5560e02fb2bba583435:8)
danharrin commented 2 years ago

Hey, thanks for the issue. I've investigated it and I'm pretty sure that this is in a bug within Livewire and not Filament:

Thankfully it doesn't affect the functionality of the repeater at all (as far as I know). Let me know if this isn't the case.

I may be wrong - if I am and you find a fix for this within Filament, please submit a PR.