awcodes / filament-curator

A media picker plugin for Filament Panels.
MIT License
343 stars 89 forks source link

When calling multiple CuratorPicker::make on the same for, the page crashes #241

Closed matt-shirey closed 1 year ago

matt-shirey commented 1 year ago

Whenever I add multiple CuratorPicker::make to my form, it causes the form to throw an error.

Code:

use Awcodes\Curator\Components\Forms\CuratorPicker;

CuratorPicker::make('thumbnail')
    ->label('Thumbnail Image')
    ->disk('local')
    ->directory('selections'),
CuratorPicker::make('main_image')
    ->label('Main Image')
    ->disk('local')
    ->directory('selections'),

Error: Awcodes\Curator\Components\Forms\CuratorPicker::Awcodes\Curator\Components\Forms\{closure}(): Argument #2 ($state) must be of type array|int|null, string given, called in...

awcodes commented 1 year ago

One of your fields is returning a string instead of a media record or media record id. You'll need to debug further to see why that is.

matt-shirey commented 1 year ago

@awcodes Thank you. I missed that the field had old data in it.