lara-zeus / bolt

form builder for your users, with so many use cases
https://larazeus.com/bolt
MIT License
172 stars 31 forks source link

[Bug]: Filament\Forms\ComponentContainer::Filament\Forms\Concerns\{closure}(): Argument #1 ($component) must be of type Filament\Forms\Components\Component, null given #294

Closed eelco2k closed 3 months ago

eelco2k commented 3 months ago

What happened?

I'm getting this error when editing/adding a form. It looks like it has to do with some Fields:

Checkbox DateTimePicker Toggle DatePicker RichEditor TimePicker Textarea Paragraph

and specific with the Bolt::hasPro() true/false check --> null

so when i add a field "CheckBoxList" for example, then i receive the error:

Filament\Forms\ComponentContainer::Filament\Forms\Concerns\{closure}(): Argument #1 ($component) must be of type Filament\Forms\Components\Component, null given

After digging some deeper i came out at the function:

 public static function getOptionsHidden(): array

when i comment out the line:

Bolt::hasPro() ? \LaraZeus\BoltPro\Facades\GradeOptions::hidden() : null,

that part works and i won't get any error anymore.

So i tried using that return array to be with array_filter(). So that NULL values will be removed. This helps.

I see a lot of places where Bolt::hasPro() is used and i think because maybe latest filament update cannot handle the null values for the "field Options" in the dialog.

i'm using Filament version: v3.2.85

How to reproduce the bug

update to latest filament and zeus-bolt. create a new form, and add a field with one of the types :

Checkbox DateTimePicker Toggle DatePicker RichEditor TimePicker Textarea Paragraph

Package Version

3.0.46

PHP Version

8.3.7

Laravel Version

10.48.12

Which operating systems does with happen with?

No response

Notes

No response

atmonshi commented 3 months ago

thank you for the report, the PR on the way :) #295

eelco2k commented 3 months ago

i'm sorry to say @atmonshi but the same error also occurs with $newClass->getOptions() in Schemata.php in latest version. (v3.0.56)

for each of the Field/Classes/ (TextInput.php for example) you have set:

  Bolt::getCustomSchema('field', resolve(static::class)) ?? [],

but that needs to be changed as well to:

  ...Bolt::getCustomSchema('field', resolve(static::class)) ?? [],

and i think it also has to be added in some other places like:

Bolt::hasPro() ? \LaraZeus\BoltPro\Facades\GradeOptions::hidden() : [],

to be:

...Bolt::hasPro() ? \LaraZeus\BoltPro\Facades\GradeOptions::hidden() : [],
atmonshi commented 3 months ago

I cant reproduce :) do you have Bolt pro?

I have an app, no bolt pro, and no CustomSchema. the getCustomSchema wont return array, so it will break if you have Custom Schema

Only arrays and Traversables can be unpacked

but maybe you're right about the GradeOptions, still cant get the error!

can you share the error trace?

eelco2k commented 3 months ago

No i don't use CustomSchema. I was referring to Schemata.php in your package. And no I don’t have Bolt Pro.

I will share error trace but because it uses Livewire (/update method) I couldn’t see much in the trace-back. So I stepped through the code with Xdebug.

eelco2k commented 3 months ago

Here is error trace:

[2024-06-13 10:08:43] production.ERROR: Filament\Forms\ComponentContainer::Filament\Forms\Concerns\{closure}(): Argument #1 ($component) must be of type Filament\Forms\Components\Component, array given {"userId":1,"exception":"[object] (TypeError(code: 0): Filament\\Forms\\ComponentContainer::Filament\\Forms\\Concerns\\{closure}(): Argument #1 ($component) must be of type Filament\\Forms\\Components\\Component, array given at ~/filament-project/vendor/filament/forms/src/Concerns/HasComponents.php:102)
[stacktrace]
#0 [internal function]: Filament\\Forms\\ComponentContainer->Filament\\Forms\\Concerns\\{closure}(Array)
#1 ~/filament-project/vendor/filament/forms/src/Concerns/HasComponents.php(102): array_map(Object(Closure), Array)
#2 ~/filament-project/vendor/filament/forms/src/Concerns/HasState.php(202): Filament\\Forms\\ComponentContainer->getComponents(true)
#3 ~/filament-project/vendor/filament/forms/src/Components/Concerns/HasState.php(219): Filament\\Forms\\ComponentContainer->hydrateState(NULL, true)
#4 ~/filament-project/vendor/filament/forms/src/Concerns/HasState.php(203): Filament\\Forms\\Components\\Component->hydrateState(NULL, true)
#5 ~/filament-project/vendor/filament/forms/src/Components/Concerns/HasState.php(219): Filament\\Forms\\ComponentContainer->hydrateState(NULL, true)
#6 ~/filament-project/vendor/filament/forms/src/Concerns/HasState.php(203): Filament\\Forms\\Components\\Component->hydrateState(NULL, true)
#7 ~/filament-project/vendor/filament/forms/src/Concerns/HasState.php(188): Filament\\Forms\\ComponentContainer->hydrateState(NULL, true)
#8 ~/filament-project/vendor/filament/actions/src/Concerns/CanBeMounted.php(34): Filament\\Forms\\ComponentContainer->fill(Array)
#9 ~/filament-project/vendor/filament/support/src/Concerns/EvaluatesClosures.php(35): Filament\\Actions\\MountableAction->Filament\\Actions\\Concerns\\{closure}(Object(Filament\\Forms\\Form))
#10 ~/filament-project/vendor/filament/actions/src/Concerns/CanBeMounted.php(18): Filament\\Support\\Components\\Component->evaluate(Object(Closure), Array)
#11 ~/filament-project/vendor/filament/forms/src/Concerns/HasFormComponentActions.php(158): Filament\\Actions\\MountableAction->mount(Array)
#12 ~/filament-project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Filament\\Pages\\BasePage->mountFormComponentAction('data.sections.r...', 'fields options', Array)
#13 ~/filament-project/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#14 ~/filament-project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))
#15 ~/filament-project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#16 ~/filament-project/vendor/livewire/livewire/src/Wrapped.php(23): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array)
#17 ~/filament-project/vendor/livewire/livewire/src/Mechanisms/HandleComponents/HandleComponents.php(474): Livewire\\Wrapped->__call('mountFormCompon...', Array)
#18 ~/filament-project/vendor/livewire/livewire/src/Mechanisms/HandleComponents/HandleComponents.php(101): Livewire\\Mechanisms\\HandleComponents\\HandleComponents->callMethods(Object(LaraZeus\\Bolt\\Filament\\Resources\\FormResource\\Pages\\EditForm), Array, Object(Livewire\\Mechanisms\\HandleComponents\\ComponentContext))
#19 ~/filament-project/vendor/livewire/livewire/src/LivewireManager.php(97): Livewire\\Mechanisms\\HandleComponents\\HandleComponents->update(Array, Array, Array)
#20 ~/filament-project/vendor/livewire/livewire/src/Mechanisms/HandleRequests/HandleRequests.php(93): Livewire\\LivewireManager->update(Array, Array, Array)
#21 ~/filament-project/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(46): Livewire\\Mechanisms\\HandleRequests\\HandleRequests->handleUpdate()
#22 ~/filament-project/vendor/laravel/framework/src/Illuminate/Routing/Route.php(259): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(Livewire\\Mechanisms\\HandleRequests\\HandleRequests), 'handleUpdate')
#23 ~/filament-project/vendor/laravel/framework/src/Illuminate/Routing/Route.php(205): Illuminate\\Routing\\Route->runController()
#24 ~/filament-project/vendor/laravel/framework/src/Illuminate/Routing/Router.php(806): Illuminate\\Routing\\Route->run()
#25 ~/filament-project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#26 ~/filament-project/vendor/bilfeldt/laravel-route-statistics/src/Http/Middleware/RouteStatisticsMiddleware.php(22): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#27 ~/filament-project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Bilfeldt\\LaravelRouteStatistics\\Http\\Middleware\\RouteStatisticsMiddleware->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#28 ~/filament-project/vendor/kenepa/translation-manager/src/Http/Middleware/SetLanguage.php(26): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#29 ~/filament-project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Kenepa\\TranslationManager\\Http\\Middleware\\SetLanguage->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#30 ~/filament-project/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(50): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#31 ~/filament-project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#32 ~/filament-project/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(78): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#33 ~/filament-project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#34 ~/filament-project/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#35 ~/filament-project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#36 ~/filament-project/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(121): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#37 ~/filament-project/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\\Session\\Middleware\\StartSession->handleStatefulRequest(Object(Illuminate\\Http\\Request), Object(Illuminate\\Session\\Store), Object(Closure))
#38 ~/filament-project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Session\\Middleware\\StartSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#39 ~/filament-project/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#40 ~/filament-project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#41 ~/filament-project/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#42 ~/filament-project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#43 ~/filament-project/vendor/stancl/tenancy/src/Middleware/IdentificationMiddleware.php(36): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#44 ~/filament-project/vendor/stancl/tenancy/src/Middleware/InitializeTenancyByDomain.php(37): Stancl\\Tenancy\\Middleware\\IdentificationMiddleware->initializeTenancy(Object(Illuminate\\Http\\Request), Object(Closure), 'lemmens.lan.syz...')
#45 ~/filament-project/vendor/stancl/tenancy/src/Middleware/InitializeTenancyByDomainOrSubdomain.php(24): Stancl\\Tenancy\\Middleware\\InitializeTenancyByDomain->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#46 ~/filament-project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Stancl\\Tenancy\\Middleware\\InitializeTenancyByDomainOrSubdomain->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#47 ~/filament-project/vendor/stancl/tenancy/src/Middleware/PreventAccessFromCentralDomains.php(29): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#48 ~/filament-project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Stancl\\Tenancy\\Middleware\\PreventAccessFromCentralDomains->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#49 ~/filament-project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#50 ~/filament-project/vendor/laravel/framework/src/Illuminate/Routing/Router.php(805): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#51 ~/filament-project/vendor/laravel/framework/src/Illuminate/Routing/Router.php(784): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#52 ~/filament-project/vendor/laravel/framework/src/Illuminate/Routing/Router.php(748): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#53 ~/filament-project/vendor/laravel/framework/src/Illuminate/Routing/Router.php(737): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#54 ~/filament-project/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(200): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#55 ~/filament-project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))
#56 ~/filament-project/vendor/livewire/livewire/src/Features/SupportDisablingBackButtonCache/DisableBackButtonCacheMiddleware.php(19): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#57 ~/filament-project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Livewire\\Features\\SupportDisablingBackButtonCache\\DisableBackButtonCacheMiddleware->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#58 ~/filament-project/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(59): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#59 ~/filament-project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Barryvdh\\Debugbar\\Middleware\\InjectDebugbar->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#60 ~/filament-project/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#61 ~/filament-project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#62 ~/filament-project/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(36): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#63 ~/filament-project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#64 ~/filament-project/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#65 ~/filament-project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#66 ~/filament-project/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(99): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#67 ~/filament-project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#68 ~/filament-project/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#69 ~/filament-project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\HandleCors->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#70 ~/filament-project/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(39): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#71 ~/filament-project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#72 ~/filament-project/vendor/bilfeldt/laravel-route-statistics/src/Http/Middleware/RouteStatisticsMiddleware.php(22): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#73 ~/filament-project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Bilfeldt\\LaravelRouteStatistics\\Http\\Middleware\\RouteStatisticsMiddleware->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#74 ~/filament-project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#75 ~/filament-project/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(175): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#76 ~/filament-project/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(144): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#77 ~/filament-project/public/index.php(51): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#78 ~/filament-project/vendor/laravel/framework/src/Illuminate/Foundation/resources/server.php(16): require_once('/..')
#79 {main}
"} 
eelco2k commented 3 months ago

So what i mean is that in Schemata.php Line 426 the function $class->getOptions() gets called. $class is new instance of the field_type, for example the TextInput.php class in src/Fields/Classes/TextInput.php but that depends on the type you've added to the form. So as an example I will use the TextIput.php (but it applies to all src/Fiels/Classes/ php classes) :

In that Class the function getOptions() creates an Accordion.. but when you do this:

Accordions::make('options')
                ->accordions([
                     // removed first 2 accordions in this example
                     // Accordion::make('validation-options')
                     //  Accordion::make('visual-options') ),
                    self::hintOptions(),
                    self::visibility($sections),
                    // @phpstan-ignore-next-line
                    ...Bolt::hasPro() ? \LaraZeus\BoltPro\Facades\GradeOptions::schema($field) : [],
                    Bolt::getCustomSchema('field', resolve(static::class)) ?? [],
                ]),

the accordions([.......]) array will have a last item which is an empty array. But ->accordions() function only accepts childs as a

So by adding the three dots... the whole item would not get added to the ->accordions([ .......... ]) array.

or use the array_filter again on the array ;-) which also filters out the empty values in the array.

like so:

Accordions::make('options')
                ->accordions(
                array_filter([
                    // removed first 2 accordions in this example
                    // Accordion::make('validation-options')
                    //  Accordion::make('visual-options') ),
                    self::hintOptions(),
                    self::visibility($sections),
                    // @phpstan-ignore-next-line
                    ...Bolt::hasPro() ? \LaraZeus\BoltPro\Facades\GradeOptions::schema($field) : [],
                    Bolt::getCustomSchema('field', resolve(static::class)) ?? [],
                ])
                ),

or with the ... dots:

Accordions::make('options')
                ->accordions([
                    // removed first 2 accordions in this example
                    // Accordion::make('validation-options')
                    //  Accordion::make('visual-options') ),
                    self::hintOptions(),
                    self::visibility($sections),
                    // @phpstan-ignore-next-line
                    ...Bolt::hasPro() ? \LaraZeus\BoltPro\Facades\GradeOptions::schema($field) : [],
                    ...Bolt::getCustomSchema('field', resolve(static::class)) ?? [],
                ]),

see: https://www.php.net/manual/en/function.array-filter.php if callback is not used: If no callback is supplied, all empty entries of array will be removed. See [empty()](https://www.php.net/manual/en/function.empty.php) for how PHP defines empty in this case.

So than it does not matter if there are [], null or "" items in the array, they will all get removed, as they don't belong there. because in the example here above: ->accordions() only accepts an array of Component(s).

atmonshi commented 3 months ago

I'll debug more :)

also worth mention this is how accordions works

public function accordions(array | Closure $accordions): static
    {
        if (is_array($accordions)) {
            $accordions = array_filter($accordions);
        }

        $this->childComponents($accordions);

        return $this;
    }
eelco2k commented 3 months ago

Perfect also! You’ve added the array_filter in the accordion() function 👍🏻

atmonshi commented 3 months ago

I need the 3 dots here: ...Bolt::hasPro() ? \LaraZeus\BoltPro\Facades\GradeOptions::schema($field) : [],

coz the GradeOptions::schema will return array so I need the ... to append it to the accordions array and it will filtered in the accordions method.

I dont need the dots here: Bolt::getCustomSchema('field', resolve(static::class)) ?? [],

coz the getCustomSchema will return Accordion::make so adding ... will break if you use Custom Schema, otherwise it will return empty array and will be filtered in the accordions method

I will create a fresh app and test it more tho till I find the issue you got.

atmonshi commented 3 months ago

Perfect also! You’ve added the array_filter in the accordion() function 👍🏻

make sure you updated that package too, it could be the issue here?

eelco2k commented 3 months ago

I’m at version v3.0.56

atmonshi commented 3 months ago

I mean: https://github.com/lara-zeus/accordion

eelco2k commented 3 months ago

I haven’t specifically required it in my project. Only Lara-Zeus/bolt But I will composer require Lara-Zeus/accordion

and that shows me version:v1.1.3

eelco2k commented 3 months ago

Yes after updating to latest accordion the with array_filter in it everything works as it should. Awesome job!

atmonshi commented 3 months ago

ah finally :) just created a new app to install bolt... deleting glade to here that 👍

eelco2k commented 3 months ago

I think that in bolt package composer.json the lara-zeus/accordion: “^1.0”,

Did not upgrade correctly. Not sure why…? because my package was at version 1.1.0 Only after explicit require the package so that it came in the main composer.json it got updated to 1.1.3

atmonshi commented 3 months ago

ya I think it should be: "lara-zeus/accordion": "^1.1",

will update it

eelco2k commented 3 months ago

Very weird but it’s fixed anyways

lara-zeus/bolt/composer.lock file I found lara-zeus/accordion version 1.1.3 So according to the package lock file it should already be there even before i did composer require lara-zeus/accordion in my projectwide specifically. Never mind. It’s fixed 😬👌🏻