bolt icon indicating copy to clipboard operation
bolt copied to clipboard

[Bug]: getCustomSchema will make problem for all of fields

Open mrhappyheart opened this issue 7 months ago • 5 comments

What happened?

Filament\Forms\ComponentContainer::Filament\Forms\Concerns{closure}(): Argument #1 ($component) must be of type Filament\Forms\Components\Component, array given {"userId":4,"exception":"[object] (TypeError(code: 0): Filament\Forms\ComponentContainer::Filament\Forms\Concerns\{closure}(): Argument #1 ($component) must be of type Filament\Forms\Components\Component, null given at /home/yallaxom/public_html/vendor/filament/forms/src/Concerns/HasComponents.php:122)

How to reproduce the bug

in most of the fields this line makss problem in codes: Bolt::getCustomSchema('field', resolve(static::class)) ?? []

example in FileUpload.php (vendor\lara-zeus\bolt\src\Fields\Classes\FileUpload.php)

public static function getOptions(?array $sections = null): array
    {
        return [
            Accordions::make('check-list-options')
                ->accordions([
                    Accordion::make('general-options')
                        ->label(__('General Options'))
                        ->icon('iconpark-checklist-o')
                        ->schema([
                            \Filament\Forms\Components\Toggle::make('options.allow_multiple')->label(__('Allow Multiple')),
                            self::required(),
                            self::columnSpanFull(),
                            self::htmlID(),
                        ]),
                    self::hintOptions(),
                    self::visibility($sections),
                    Bolt::getCustomSchema('field', resolve(static::class)) ?? [],
                ]),
        ];
    }

error : Filament\Forms\ComponentContainer::Filament\Forms\Concerns\{closure}(): Argument #1 ($component) must be of type Filament\Forms\Components\Component, null given {"userId":4,"exception":"[object] (TypeError(code: 0): Filament\\Forms\\ComponentContainer::Filament\\Forms\\Concerns\\{closure}(): Argument #1 ($component) must be of type Filament\\Forms\\Components\\Component, null given at /home/yallaxom/public_html/vendor/filament/forms/src/Concerns/HasComponents.php:122)

when you remove the line the problem will be solved

Package Version

3.0.59

PHP Version

8.2.*

Laravel Version

11

Which operating systems does with happen with?

No response

Notes

No response

mrhappyheart avatar Jul 09 '24 08:07 mrhappyheart