Closed niccolofavari closed 5 months ago
Can you share a reproduction repo. ->defaultItems(0)
is working for me.
Are you using the panels or the stand alone forms package?
I just encountered the same issue (error), here is my repeater
TableRepeater::make('variants')
->visible(fn(Forms\Get $get): bool => $get('type') === Product::$TYPE_VARIANTS)
->relationship('variants')
->hideLabels()
->emptyLabel("")
->defaultItems(0)
->addable(false)
->label(fn(Forms\Get $get) => __('fields.customize_options') . " (" . $get('variants_count') . ")")
->addActionLabel(__('fields.add'))
->live()
->deleteAction(
fn(Forms\Components\Actions\Action $action) => $action->requiresConfirmation(),
)
->columnWidths([
'name' => '200px',
'warehouse_id' => '200px',
'qty' => '90px',
'unlimited_qty' => '10px',
'unit_cost' => '135px',
'price' => '135px',
'discount_price' => '135px',
])
Yea, still trying to think of a solution for this. It has to read the child components to dynamic create the headers and if there are no items then it can generate the headers.
A reproduction repo would really help me out.
I still can't replicate this and the only difference I'm seeing is that your repeaters are based on relationships and I currently don't have anything setup where I am using relationships that I could test with.
Closing as stale.
Filament Version
v3
Plugin Version
v2.1.0
PHP Version
PHP 8.3.0
Problem description
Using
defaultItems(0)
will result in aTyped property Filament\Forms\Components\Component::$container must not be accessed before initialization
error. A simple repeater will not issue this error and works as expected. The issue is resolved when using a custom label for each fields.Expected behavior
Expected an empty repeater in the create form.
Steps to reproduce
I'm using this code
Adding a
->label("Custom label")
for each field will resolve the issue.Reproduction repository
No response
Relevant log output
No response