Only show header action if table has records

Is there a better(performance/cached) way of only showing a header action if the table has records?
$table->query()
    ->columns([])
    ->headerActions([
        ExportAction::make('Export')
            ->visible(fn () => $this->table->getRecords()->isNotEmpty()),
Solution
So, looking into the table component, it calls $records = $getRecords() and also uses count($records) ... so, what you're doing is probably fine.
Was this page helpful?