Skip to content

Commit f051976

Browse files
committed
Fix table action not receiving record in evaluate() context
The action callback was not passing $record explicitly to evaluate(), so impersonateRecord closures resolved to null in table row contexts. This matched the same pattern already fixed for the visible callback.
1 parent dbe1060 commit f051976

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

src/Actions/Impersonate.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,10 @@ protected function setUp(): void
2727
$this->icon('impersonate-icon');
2828

2929
$this->impersonateRecord(fn ($record) => $record);
30-
$this->action(fn () => $this->impersonate($this->evaluate($this->impersonateRecord)));
31-
3230
// Filament's evaluate() only auto-injects closure parameters that match named bindings.
3331
// We pass 'record' explicitly so that closures like fn($record) => $record->relationship
3432
// resolve correctly in table row contexts where the record isn't otherwise bound.
33+
$this->action(fn ($record) => $this->impersonate($this->evaluate($this->impersonateRecord, ['record' => $record])));
3534
$this->visible(fn ($record) => $this->canImpersonate($this->evaluate($this->impersonateRecord, ['record' => $record])));
3635
}
3736

0 commit comments

Comments
 (0)