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
18.16k stars 2.84k forks source link

Builder reactivity broken when using previews #13971

Open martin-ro opened 1 month ago

martin-ro commented 1 month ago

Package

filament/filament

Package Version

v3.2.99

Laravel Version

v11.20.0

Livewire Version

No response

PHP Version

PHP 8.2

Problem description

When using the blockPreviews for Builder the reactivity in the modal form doesn't work once the block is saved.

https://github.com/user-attachments/assets/0fb1a824-7025-4f7e-937e-9d1523ea96d1

Expected behavior

Same as without blockPreviews

Steps to reproduce

See https://github.com/martin-ro/block-builder (UserResource)

or

add this to a from:

Forms\Components\Builder::make('blocks')
                    ->blockPreviews()
                    ->schema([
                        Forms\Components\Builder\Block::make('test')
                            ->preview('components.test')
                            ->schema([
                                Forms\Components\Checkbox::make('is_company')
                                    ->live(),

                                Forms\Components\TextInput::make('company_name')
                                    ->hidden(fn(Forms\Get $get): bool => !$get('is_company'))
                            ])
                    ])

Reproduction repository (issue will be closed if this is not valid)

https://github.com/martin-ro/block-builder

Relevant log output

No response

Donate 💰 to fund this issue

Fund with Polar

martin-ro commented 1 day ago

Another observation I just made is that wrapping components in for example a group or fieldset reactivity works inside it. So this is only broken for "top level" components.