Skip to content

disabled state doesn't update when using partial render in table repeater #19211

@CharlieEtienne

Description

@CharlieEtienne

Package

filament/filament

Package Version

v4.7.0

Laravel Version

v12.50.0

Livewire Version

v3.7.8

PHP Version

8.4.17

Problem description

When using partiallyRenderComponentsAfterStateUpdated inside a table repeater, the disabled state is not correctly updated.
It happens only with a combination of repeater with table method, partiallyRenderComponentsAfterStateUpdated, and disabled on the targeted field.

Example:

Repeater::make('repeater')
    ->table([
        Repeater\TableColumn::make('Checked'),
        Repeater\TableColumn::make('Type'),
    ])
    ->schema([
        Toggle::make('checked')
            ->live()
            ->partiallyRenderComponentsAfterStateUpdated([
                'type',
            ])
            ->afterStateUpdated(function (Set $set, bool $state) {
                if ($state) {
                    $set('type', 'radio');
                }
            }),
        Select::make('type')
            ->options([
                'radio' => 'Radio',
                'checkbox' => 'Checkbox',
                'toggle' => 'Toggle',
                'select' => 'Select',
            ])
            ->disabled(fn (Get $get) => $get('checked')),
    ]),

In this example, the Select field value is correctly updated but not disabled.

If you remove this part

->partiallyRenderComponentsAfterStateUpdated([
        'type',
    ])

it works normally.

I will try to submit a fix for that today.

Expected behavior

The Select field should be automatically disabled on state update

Steps to reproduce

  1. Install reproduction repository
  2. Go to the Issue menu
  3. Add an element in repeater
  4. Try to toggle

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

https://github.com/CharlieEtienne/filament-partial-render-in-table-repeater

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions