Skip to content

Bug: Incorrect loading indicators on table actions after changing default record #19798

@ahmed-rashad-alnaggar

Description

@ahmed-rashad-alnaggar

Package

filament/filament

Package Version

v5.6.1

Laravel Version

v13.6.0

Livewire Version

v4.2.4

PHP Version

PHP 8.3

Problem description

I have a Filament table listing languages. Each record has two actions:

  • Delete
  • Make default language

Behavior

  • For the default language:
    • Delete is hidden
    • Make default is disabled

Issue

After changing the default language, interacting with the previous default record causes inconsistent loading indicators:

  1. Clicking Make default languageno loading indicator appears
  2. Clicking Deleteboth actions show loading indicators at the same time

Important detail

  • The issue always affects the record that was default on initial page load
  • Even after switching the default multiple times, the problem stays tied to that original record
  • If the page is refreshed, the issue resets and affects the new default at load

Screen Recording

github-issue.webm

Expected behavior

  • Each action should show its own correct loading state
  • Loading indicators should not leak between actions or records

Steps to reproduce

Table Setup

return $table
            ->records( static fn (): array => /* languages api */ )
            ->columns([
                TextColumn::make('language')
                    ->label(__('columns.language.label')),

                TextColumn::make('is_default')
                    ->label(__('columns.is_default.label'))
                    ->formatStateUsing(static fn (bool $state): ?string => $state ? __('columns.is_default.badge') : null)
                    ->badge(static fn (bool $state): bool => $state)
                    ->color('success')
                    ->icon(static fn (bool $state): ?\BackedEnum => $state ? Heroicon::Star : null)
                    ->size(TextSize::Medium)
            ])
            ->recordActions(
                ActionGroup::make([
                    MakeLanguageDefaultAction::make(),
                    DeleteLanguageAction::make()
                ])->color('gray')
            )
            ->reorderable(
                column: 'order',
                condition: static fn () => count($websiteSettingsService->getLanguages()) > 1
            )
            ->paginated(false);

Make Default Language Action Setup

return Action::make('make_language_default')
            ->label(__('label'))
            ->color('success')
            ->icon(Heroicon::Star)
            ->hidden(static fn (array $record): bool => $record['is_default'])
            ->action(static function (Component $livewire, array $record): void {
               // Set default language

                $livewire->resetTable();
            });

Delete Language Action Setup

return DeleteAction::make('delete_language')
            ->modal()
            ->modalHeading(static fn (array $record) =>
                __('modal.heading', ['language' => $record['language']->getName()]))
            ->hidden(false)
            ->disabled(static fn (array $record): bool => $record['is_default'])
            ->successNotification(null)
            ->action(static function (Component $livewire, array $record): void {
               // delete language

                $livewire->resetTable();
            });

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

https://github.com/ahmed-rashad-alnaggar/filament-tables-actions-issue

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    Todo

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions