Skip to content

fix: Actions inheriting props from groups#11899

Merged
danharrin merged 1 commit into
3.xfrom
fix/action-inheriting-from-group
Mar 17, 2024
Merged

fix: Actions inheriting props from groups#11899
danharrin merged 1 commit into
3.xfrom
fix/action-inheriting-from-group

Conversation

@danharrin
Copy link
Copy Markdown
Member

Fixes #11850.

@danharrin danharrin added the bug Something isn't working label Mar 17, 2024
@danharrin danharrin added this to the v3 milestone Mar 17, 2024
@danharrin danharrin merged commit a0873e9 into 3.x Mar 17, 2024
@danharrin danharrin deleted the fix/action-inheriting-from-group branch March 17, 2024 20:47
@nicko170
Copy link
Copy Markdown
Contributor

This has broken actions within a group on tables, if they're not the standard View / Edit / Delete action, downgrading back to 3.2.50 fixes.

$table
  ->actions([
    Tables\Actions\ActionGroup::make([
      Tables\Actions\ViewAction::make(),
      Tables\Actions\Action::make('download_invoice')
        ->label('Download Invoice')
        ->icon('heroicon-o-arrow-down-on-square')
        ->action(fn (Invoice $record) => static::run($record))
    ])
 ])

Now throws an error when $record is accessed,

Argument #1 ($record) must be of type Illuminate\Database\Eloquent\Model, null given, called in /Users/nickp/code/node/vendor/filament/support/src/Concerns/EvaluatesClosures.php on line 35

@danharrin
Copy link
Copy Markdown
Member Author

Fixed

@darkclow4
Copy link
Copy Markdown
Contributor

This has broken actions within a group on tables, if they're not the standard View / Edit / Delete action, downgrading back to 3.2.50 fixes.

$table
  ->actions([
    Tables\Actions\ActionGroup::make([
      Tables\Actions\ViewAction::make(),
      Tables\Actions\Action::make('download_invoice')
        ->label('Download Invoice')
        ->icon('heroicon-o-arrow-down-on-square')
        ->action(fn (Invoice $record) => static::run($record))
    ])
 ])

Now throws an error when $record is accessed,

Argument #1 ($record) must be of type Illuminate\Database\Eloquent\Model, null given, called in /Users/nickp/code/node/vendor/filament/support/src/Concerns/EvaluatesClosures.php on line 35

i think i still get this error when i want to hide action group based on record's data

$table
    ->actions([
        Tables\Actions\ActionGroup::make([
            Tables\Actions\EditAction::make(),
            Tables\Actions\DeleteAction::make(),
        ])->hidden(fn (Model $record) => $record->active)
    ])

downgrading back to 3.2.50 fixes this error.

@danharrin
Copy link
Copy Markdown
Member Author

@darkclow4 #11955

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

assertActionHidden() not accounting for Action's ActionGroup

3 participants