Skip to content

Problem with direct action usage in Repeater schema #17141

@Odion-DS

Description

@Odion-DS

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

No one assigned

    Projects

    Status

    Todo

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions