-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Description
Package
filament/filament
Package Version
v4.0.0-beta20
Laravel Version
12.21.0
Livewire Version
3.6.4
PHP Version
v8.4.8
Problem description
If an Action is defined directly inside the schema of a Repeater (without being wrapped in any layout component), the action’s state is the entire repeater state.
Expected behavior
I expected the action's state to be scoped to the current ChildSchema, meaning it should refer only to the specific Repeater item it is defined within, not the entire Repeater's state.
When the action is wrapped in a layout component such as a Fieldset, Group, or Section, it behaves as expected and the state is correctly scoped to the current Repeater item.
This issue also occurs when using custom components that contain multiple childSchema entries with different statePaths, actions inside those child schemas inherit the full state of the parent component rather than their localized schema state.
My assumption is that the action’s state is being bound to the parent component, rather than to the schema container (such as the individual Repeater item or ChildSchema) in which the action is defined..
Steps to reproduce
To reproduce the issue, follow these steps:
- In any Filament form, add a Repeater field.
- Inside the repeater’s schema, define an Action directly (without wrapping it in a layout component like Group, Section, etc.).
- In the action’s callback, dump the $state and $component.
Repeater::make('repeater')
->default($default)
->schema([
TextInput::make('name'),
TextInput::make('some_data'),
Action::make('some_action')
->action(fn($state, $component) => dd($state, $component))
->label('Some Action')
])-Wrap the action in an group and you will get the itemState.
Repeater::make('repeater')
->default($default)
->schema([
TextInput::make('name'),
TextInput::make('some_data'),
Group::make([
Action::make('some_action')
->action(fn($state, $component) => dd($state, $component))
->label('Some Action')
])
])Reproduction repository (issue will be closed if this is not valid)
https://github.com/Odion-DS/filament-reproduction-bug-action-in-repeater
Relevant log output
Metadata
Metadata
Assignees
Labels
Type
Projects
Status